SQL Query Action—Setting Properties

The SQL Query action is used to send a SQL statement to a database via OLE DB. The statement can be a query or any other type of SQL statement. If it is a query, AutoMate populates a dataset with the query results. To use the results of a query, create an additional step using the Loop Dataset action to retrieve the data from the dataset.

Some knowledge of SQL is necessary to set properties for this action.

To set SQL Query properties

  1. From the Task Builder Available Actions pane, open the Database folder and double-click the SQL Query action or drag it into the Steps pane.

  2. In the Connection string type box, select from the drop-down list. Then enter the properties for your selection:

  3. If you want the user name and password for the database server to be required every time the step runs, select Prompt user for a name and password.

  4. If you are setting up a query: in the Create and populate dataset box, enter a name for the dataset to be populated with the query results. (Dataset names must be alphanumeric, begin with a letter, and contain no spaces.)

  5. In the SQL statement box, enter the SQL statement to use. You can enter multiple statements separated by semicolons. If more than one statement returns data to a dataset, the first will be the one recorded.

  6. If you want to enable the use of cached data, click the Cache tab, and select Used cached query data if execution date is after. Then use the date and time boxes to select a date and time. You can also click the Custom button and select a limiter such as Last 24 hours, or you can select Expression and enter an expression.

  7. Click the Advanced tab, and enter the properties as follows:

  8. To set the Description tab properties, refer to Description Tab Options.

  9. To set the Error Causes and On Error tab properties, refer to Step Error Handling.

  10. When finished, click OK to save settings and close the properties dialog window.

See Also

About Actions

Adding Task Steps

Execute SQL Query Action