Execute Process Task in ssis
For SSIS packages, most of the times you will get zip, rar or tar etc files and need to extract them during the extraction operation in SSIS. Let us see how we can do this directly from SSIS.
You can use the Execute Process Task in the Control Flow task. In BIDS Simply drag and drop an Execute Process task to the control flow and configure as shown below:
In the Execute Process, you need to perform three configurations:
- Executable: This is the path of the application you are going to use. This specific example has used Winrar.
- Arguments: In this you need to supply the arguments to extract the zipped files. In the particular example e stands for Extract files to current directory. Then the full path name of the zipped file. –o+ is a parameter to say overwrite files if they exist.
- Working Directory: This is the current directory for the process. In the given example test1.rar will be extracted to the directory given in the Working Directory attribute.
Example 2: execute a command line commands such as DIR, COPY, DEL, RENAME
Execute Process Task is used to execute the external application in SSIS.
If you need to execute a command line commands such as DIR, COPY, DEL, RENAME, etc. then you have to use cmd.exe command that is located in c:\windows\system32\
CMD.exe requires an additional argument /C while executing command line commands in Execute Process Task. Otherwise, It will not execute the given command.
In this example, I will show you how to create a folder using command line commands.
Step 1: Create a SSIS package
Step 2: Add Execute Process Task into the package
Step 3: Configure the task as shown below. The command we are using in this task will create a new folder in e drive. But, you can use the available drive letter in your computer.
On successful package execution, you will have a new folder SSRider in the specified drive. So, it is very simple to execute an external commands or applications in SSIS using Execute Process Task and never forget to add /C option when you are using command line commands.
Note: Command Line or Command Prompt is a Windows program that emulates many of the command line abilities available in MS-DOS but it is not actually MS-DOS.
0 comments:
Post a Comment