SSIS - How To Execute Batch File By Using SSIS Package

Scenario:

We have created a batch file that copies all the files from Source folder to Destination folder. We want to execute this batch file in SQL Server Integration Services (SSIS) Package.

Solution:

To execute batch file from SQL Server Integration Services Package, we will be using Execute Process Task from Control Flow Items.

Step 1: 
Drag Execute Process Task to Control Flow Pane. Double click or Edit it by right click
Locate the path for your Executable, In my case the CMD.exe is present on C:\Windows\System32\cmd.exe.
In Argument , provide the path of your batch file as given below
/c C:\Users\ashahzad\Desktop\Mybatch.bat

Note:
 You can create variables to save paths for Executable and Arguments so on different machines you can change those values by using SSIS Configuration.

Final Step: 
After executing our SSIS Package, we can see that the batch file was executed successfully by SSIS Package and files were copiedd from Source to Destination Folder.


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.