The Execute Process task runs an application or batch file as part of a SQL Server Integration Services package workflow. Although you can use the Execute Process task to open any standard application, such as Microsoft Excel or Microsoft Word, you typically use it to run business applications or batch files that work against a data source. For example, you can use the Execute Process task to expand a compressed text file. Then the package can use the text file as a data source for the data flow in the package. As another example, you can use the Execute Process task to run a custom Visual Basic application that generates a daily sales report. Then you can attach the report to a Send Mail task and forward the report to a distribution list.
Integration Services includes other tasks that perform workflow operations such as executing packages. For more information, see Execute Package Task
Custom Log Entries Available on the Execute Process Task
The following table lists the custom log entries for the Execute Process task. For more information, see Integration Services (SSIS) Logging.
|ExecuteProcessExecutingProcess||Provides information about the process that the task is configured to run.
Two log entries are written. One contains information about the name and location of the executable that the task runs, and the other entry records the exit from the executable.
|ExecuteProcessVariableRouting||Provides information about which variables are routed to the input and outputs of the executable. Log entries are written for stdin (the input), stdout (the output), and stderr (the error output).|
Configuration of the Execute Process Task
You can set properties through SSIS Designer or programmatically.
For more information about the properties that you can set in SSIS Designer, click one of the following topics:
For more information about how to set these properties in SSIS Designer, click the following topic:
When the Execute Process task runs a custom application, the task provides input to the application through one or both of the following methods:
An argument that you specify in the Arguments property setting. (For example, if the task opens a document in Word, the argument can name the .doc file.)
To pass multiple arguments to a custom application in one Execute Process task, use spaces to delimit the arguments. An argument cannot include a space; otherwise, the task will not run. You can use an expression to pass a variable value as the argument. In the following example, the expression passes two variable values as arguments, and uses a space to delimit the arguments:
@variable1 + " " + @variable2
You can use an expression to set various Execute Process task properties.
When you use the StandardInputVariable property to configure the Execute Process task to provide input, call the Console.ReadLine method from the application to read the input. For more information, see Console.ReadLine Methodthe topic, , in the Microsoft .NET Framework Class Library.
When you use the Arguments property to configure the Execute Process task to provide input, do one of the following steps to obtain the arguments:
If you use Microsoft Visual Basic to write the application, set the My.Application.CommandLineArgs property. The following example sets the My.Application.CommandLineArgs property is to retrieve two arguments:
Dim variable1 As String = My.Application.CommandLineArgs.Item(0) Dim variable2 As String = My.Application.CommandLineArgs.Item(1)
For more information, see the topic, My.Application.CommandLineArgs Property, in the Visual Basic reference.
If you use Microsoft Visual C# to write the applicate, use the Main method.
For more information, see the topic, Command-Line Arguments (C# Programming Guide), in the C# Programming Guide.
The Execute Process task also includes the StandardOutputVariable and StandardErrorVariable properties for specifying the variables that consume the standard output and error output of the application, respectively.
Additionally, you can configure the Execute Process task to specify a working directory, a time-out period, or a value to indicate that the executable ran successfully. The task can also be configured to fail if the return code of the executable does not match the value that indicates success, or if the executable is not found at the specified location.
Programmatic Configuration of the Execute Process Task
For more information about programmatically setting these properties, click the following topic: