Execute SQL

Runs a SQL command.

This action is for advanced users.

Options for this action

Connection String

A SQL connection string to use when connecting to the remote database.

Provider options are:

  • MS SQL
  • ODBC
  • OLEDB
  • Oracle

For example: Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;.

Use windows authentication

Determines that the connection to the database will be made using integrated authentication (trusted connection). When using integrated authentication, username and password fields are presented to allow the credentials of an account with sufficient database access to be provided.

Query

Enter the SQL statement directly and/or use Insert reference fields to build the string dynamically at run time.

Escape reference values for use in strings

Use this option to ensure that any value chosen from the Insert Reference button is escaped for use in a SQL string. If the entire SQL statement is contained in a single variable, then this option must be unchecked. 

Store default result

Returns the result of a SQL 'select' query.

Store result in

This list contains all the workflow variables that can be used to store the result of a SQL ‘select’ query. A collection variable can be used to store multiple records. If a variable that is not a collection is selected, only the first record will be stored. If multiple columns are returned, only the value of the first column will be stored.

Specify column names

Use this option to store the result of specific column name that is returned from a SQL 'select' query.

To specify the column:

  1. In the Column to retrieve, enter the name of the column.
  2. Click the Add button and the property will appear below the Column to retrieve box.
  3. Specify a workflow variable to store the values of the column to be retrieved.

Note: If a variable that is not a collection is selected, only the first result will be stored.

Related information

Find, add, and configure actions