locked
.Bat file to run ssis package RRS feed

  • Question

  • Could anybody provide code for .Bat file to  run ssis package and i want to run it from Tidal.
    Wednesday, October 7, 2015 11:23 AM

Answers

  • Hi Vamsivaliveti,

    To execute an SSIS package via a batch file, we shoud use DTExec utility (32 bit or 64 bit utility). The code in the batch file should be like if execute an SSIS package that is saved in the file system :
    "C:\Program Files(x86)\Microsoft SQL Server\110\DTS\Binn\DTExec.exe" /f  "D:\Sample_Packages\Test_Package.dtsx"

    Please also make sure that the folder contains the batch file have a path without space within it. For example, if the full path of the batch file is c:\folder name\batchCommand.bat, and if we run it from a command window with command c:\folder name\batchCommand.bat directly, we will get the error:
    'c:\folder' is not recognized as an internal or external command,operable program or batch file.

    Reference:
    dtexec Utility

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    Friday, October 9, 2015 8:35 AM

All replies

  • The DTEXEC.EXE utility can be invoked from a command file to run an SSIS package.  The arguments passed to the utility depend on where the package is stored.  See https://msdn.microsoft.com/en-us/library/hh231187.aspx.


    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

    Wednesday, October 7, 2015 11:35 AM
  • Thanks for Input and could you please provide bat file since i have to run  from Tidal.I know we have to use dtexex.exe command in bat file but not sure since new to windows programming
    Wednesday, October 7, 2015 11:37 AM
  • Without knowing where the package is stored and other information, I can only provide a general examples.  The SQL Server Books Online link I provided has several examples you can customize for your situation according to the parameter reference.

    The bat file to execute a package named "pckOne" stored in msdb of SQL Server "productionServer"  would be like this (copied from the first example):

    dtexec /sq pkgOne /ser productionServer


    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

    Wednesday, October 7, 2015 11:55 AM
  • see

    http://visakhm.blogspot.ae/2011/10/different-ways-to-execute-ssis-package.html

    Make a bat file with dtexec command given in above link and you can configure it to be executed from scheduled task if you want


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    Wednesday, October 7, 2015 12:12 PM
  • How to get the path for /CONFIGFILE "config file path" and what is the use of this file? and if anybody provided sample.bat file

    with dtexec command i will modify it according to my requirement

    Wednesday, October 7, 2015 12:24 PM
  • How to get the path for /CONFIGFILE "config file path" and what is the use of this file? and if anybody provided sample.bat file

    with dtexec command i will modify it according to my requirement

    The /CONFIGFILEPATH parameter is optional.  You will need to reach out to the developer of the SSIS package to determine if a configuration file is needed at all.  They may be able to help with the needed DTEXEC parameters.

    Rather than hard-coding server names, file paths, and other values that may vary by environment, SSIS packages are often coded such that environment-specific values are configurable. This allows the same package to be run in different environments like test and production without changing the package itself.  The developer of the SSIS package determined how the package is configured (assuming the values are not hard-coded).  Be aware that the configuration may be from a file, SQL server tables, environment variables, etc. The DTEXEC parameters will vary accordingly.


    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

    Thursday, October 8, 2015 11:05 AM
  • How to get the path for /CONFIGFILE "config file path" and what is the use of this file? and if anybody provided sample.bat file

    with dtexec command i will modify it according to my requirement

    You need it only if you're using a config file otherwise you can ignore it

    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    Thursday, October 8, 2015 11:21 AM
  • Hi Vamsivaliveti,

    To execute an SSIS package via a batch file, we shoud use DTExec utility (32 bit or 64 bit utility). The code in the batch file should be like if execute an SSIS package that is saved in the file system :
    "C:\Program Files(x86)\Microsoft SQL Server\110\DTS\Binn\DTExec.exe" /f  "D:\Sample_Packages\Test_Package.dtsx"

    Please also make sure that the folder contains the batch file have a path without space within it. For example, if the full path of the batch file is c:\folder name\batchCommand.bat, and if we run it from a command window with command c:\folder name\batchCommand.bat directly, we will get the error:
    'c:\folder' is not recognized as an internal or external command,operable program or batch file.

    Reference:
    dtexec Utility

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    Friday, October 9, 2015 8:35 AM