The Query Database widget executes a single SELECT, INSERT, UPDATE, or DELETE SQL statement against a database. The results of SELECT statements can be stored in a workflow variable. The widget supports SQL Server, Oracle, ODBC, and OLEDB connections.
NOTE: In the case of SELECT statements, the Query Database widget returns either a single value (field) or a single record (row). SQL statements should be constructed with this in mind.
If the query returns multiple fields or rows, the widget will only store the first row or the first field from the first row of results, depending on the variable type selected for the results. See the Save To Variable property description below for more information.
Widget Properties:
Column | Description |
Connection Type (Required) | Select the type of database connection to use. Available choices are SQL Server, ODBC, OLEDB, and Oracle. |
Connection String (Required) |
For ODBC, OLEDB, and Oracle connection types, manually enter the connection string. For SQL Server connections, click the button to define the following additional properties:
|
Query String | Enter a single SQL statement to execute against the database. SELECT statements should be constructed to return a single field from a single row or a single record (row) of results. Click the button to include lookups in your statement. |
Save to Variable | Select a workflow variable with a Text or Record data type to store the query results (applicable only for the results of a SELECT statement). Create variables in the Workflow Settings tab in the settings pane, or click the Create new variable link next to the variable list. |
Run As | This widget can run with the permissions of the workflow initiator, the workflow designer, or another user. Select the option in the Run As property that best matches your requirement. For more information, see the Common Widget Properties topic. |
Click Apply to save the widget settings. |
Example Using Query Database Widget
Return to External Data Widgets
See Also: