Skip to main content

Execute Query

Description

This activity executes a query on a database and returns the query result in a DataTable. It runs the SQL command to get the results.

Properties

Input

  • Command Type – It specifies how a command string gets interpreted. The following options are available, Text, Stored procedure, Table direct.

    • Text - It includes the name of the stored procedure to execute in SQL parameters.
    • StoredProcedure - Invokes the procedure name specified in the SQL parameter.
    • TableDirect - It contains the name of the Table and gets all records from the Table. By default, it sets to Text.
  • Connection String – The connection string used to establish a database connection.

  • Database Context – Database context variable. Note: If the Database Context variable used here is returned by Connect activity, all properties (Connection String and Provider Name) related to the database connection can be ignored.

  • Parameters – A dictionary of named parameters bound to the SQL command. The binding is done by specifying the '@parameterName' statement in the SQL command. At runtime, the parameterName will be replaced with its value from the dictionary.

  • Provider Name – The name of the database provider used to access the database.

  • Query – SQL query or stored procedure to be executed.

  • Timeout (in MS) – Specifies the amount of time (in milliseconds) to wait for the activity to run before an error is thrown. The default value is 30000 milliseconds (30 seconds). Note: The amount of time specified in this field does not include the response time for the query result retrieval. This means the total execution time of the activity may be greater than the actual query execution time, which the TimeoutMS property applies to.

Misc

  • DisplayName – Add a display name to your activity.
  • Private – By default, activity will log the values of your properties inside your workflow. If private is selected, then it stops logging.

Optional

  • Continue On Error – Specifies if the automation should continue even when the activity throws an error. This field only supports Boolean values (True, False). The default value is False.

Note: If this activity is included in Try Catch and the value of this property is True, no error is caught when the project is executed.

Output

  • Data Table – It stores the SQL query output in a DataTable variable.

Example

Download Example

Execute Query