Execute command

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
Usage
Example
Properties

Usage

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.

Example

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.

Code Editor dialog 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.

Executing an SQL command in a package Figure 2: Executing an SQL command in a package

Properties

Property group Property name Description Example
Input properties CommandText Text of the database command. CREATE TABLE DemoTable (ID INT PRIMARY KEY, FirstName VARCHAR(100)); INSERT INTO DemoTable VALUES (1, 'John'), (2, 'Jane'), (3, 'Michael');
CommandTimeout Database command timeout in seconds. 3000
CommandType Type of the database command. StoredProcedure or TableDirect or Text
Connection Database connection used to execute database command. BdxDemo
Parameters Collection of database parameters. Use pop-up window to set parameters.
Misc DisplayName Display name of the activity in the workflow. Execute command
Result Contains the masking definition object. It's a part of the masking infrastructure and should be ignored. -