Sunday 3 November 2013

Execute process task in SSIS

Today i will discuss about one of the work flow tasks execute process task(Refer tasks article to know about all tasks in SSIS).

Execute process task enables us to execute either window based or console based application inside control flow of the package and also can be used to open standard applications Microsoft word,Excel or notepad.

In Real world this task is used to unzip or decrypt file. Package then use the file as a data source for data flow task to load data

Drag and drop Execute process task from tool box on to control flow as shown in Figure 1

image Figure 1

Double click on the task which opens task editor which has only two tabs General and process. In General tab, name and description should be specified.

Next tab process contains all configuration properties required to execute process as shown in Figure 2.

image Figure 2

RequireFullFileName: property specifies whether task should fail or not if executable path not found. Process task usually checks in system 32 path or PATH environment. You need to specify full path explicitly other than those paths

Executable: Property specifies executable file name that you want to run

Arguments property specify arguments for the executable. Arguments should not be specified in executable property

WorkingDirectory: contains the directory from which executable executes

StandardInputVariable specifies variable name if arguments are passed as variables for process

StandardOuptutVariable should specifies variable name to capture output as variable

StandardErrorVariable specifies variable names if error in the process should be captured in variable

FailTaskIfReturnCodeIsNotSuccessValue indicates whether task should fail if process exit code does not match with success code

SuccessValue specifies the value to indicate success code of the process task.

Timeout specifies Time out values measures in seconds

WindowStyle specifies the appearance of new executable window. Options in the tab are normal,minimized, maximized and hidden

We will understand above process by creating a package which unzips file(products.zip) using process task.

Steps to follow:

step1: create a text file(product.txt) with the below mentioned data and ZIP the file as products.zip and Products.zip file created in D:\dot net\SSIS folder

1,prod1
2,prod2
3,prod3
4,prod4
5,prod5

step2: Drag and drop Execute process task onto control flow task

Step3: Configure process tab with the below mentioned details.

Executable C:\Program Files\WinZip\WINZIP32.EXE

Arguments for winzip32 -e -o D:\dot net\SSIS\product.zip

Working directory D:\dot net\SSIS. All other properties need not to be specified as not using in this example.

image

Step4: Execute the package once configuration done which extracts file from products.zip and places product.txt in working directory(D:\dot net\SSIS)

image

4 comments: