The Execute command activity is used to execute SQL commands over an established database connection.
This can range from creating tables, disabling triggers, etc., but it cannot handle query results.
|Table of contents|
The Execute command activity can execute commands on a connected database during package execution. This allows you to enable or disable certain options and features of the database automatically during package execution. Disabling triggers and constraints or logging additional information to the database are common uses of this activity
To use it, drag it to an already created Connect to database activity. Enter the name of the created database connection, and define the command text by clicking the field next to it. This will open a Code Editor dialog where you can write and validate your SQL commands before they are executed during package execution.
Additional options, like a CommandType and CommandTimeout can also be set if necessary.
In this example we will use the Execute command activity to create a small table and fill it with some data. We will use a Connect to database activity to create a connection to the database. Once the connection is created, place the Execute command activity inside the Connect to database activity. After setting the name of the connection as BdxDemo to match the created connection name, we can enter the command text by clicking the field next to it.
Figure 1: Code Editor dialog
This opens a separate Code Editor dialog where we can enter our SQL commands. After clicking on the Validate button to make sure the command is valid, the command is finished and ready to be executed when the package starts.
Figure 2: Executing an SQL command in a package
|Property group||Property name||Description||Example|
|Input properties||CommandText||Text of the database command.||
|CommandTimeout||Database command timeout in seconds.||
|CommandType||Type of the database command.||
|Connection||Database connection used to execute database command.||
|Parameters||Collection of database parameters.||Use pop-up window to set parameters.|
|Misc||DisplayName||Display name of the activity in the workflow.||
|Result||Contains the masking definition object. It's a part of the masking infrastructure and should be ignored.||-|