Export (0) Print
Expand All

Execute Process Task

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.

When the Execute Process task runs a custom application, the task provides input to the application through one or both of the following methods:

  • A variable that you specify in the StandardInputVariable property setting. For more information about variables, see Integration Services Variables and Using Variables in Packages.

  • 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 2005 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.

Integration Services includes other tasks that perform workflow operations such as executing packages.

For more information about these tasks, click one of the following topics:

The following table lists the custom log entries for the Execute Process task. For more information, see Implementing Logging in Packages and Custom Messages for Logging.

Log entry

Description

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).

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:

Configuring the Execute Process Task Programmatically

For more information about programmatically setting these properties, click the following topic:

Integration Services icon (small) Stay Up to Date with Integration Services

For the latest downloads, articles, samples, and videos from Microsoft, as well as selected solutions from the community, visit the Integration Services page on MSDN or TechNet:

For automatic notification of these updates, subscribe to the RSS feeds available on the page.

Updated content

  • Provided the following information about setting the Arguments property:

    • An example that shows how to use an expression to set the property.

    • A code example that shows how to set the My.Application.CommandLineArgs property in the application to get an argument.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft