SQLTABLE
![]() |
Submits an SQL (Structured Query Language) statement to a database server and returns a multi-row result. |
Supported Script Types
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Generic | Chat | Phone | Voicemail | Work Item |
Properties
- SQLQuery
- This property is the SQL statement that will be submitted to the database server. This statement should return records.
- RowSeparator
- This property is the delimiter character used to separate individual records.
- FieldCountVar
- This property is the name of the variable that will return the number of fields returned by the SQL Query.
- RowCountVar
-
This property is the name of the variable that will return the number of rows returned by the SQL Query.
The Row Count Var that is created is very helpful with a LOOP action to determine the number of times you want to repeat a sequence.
- GlobalVariables
- The property is not used.
- Publish
-
This property publishes a variable and value.
This property publishes everything in the database associated with a contact.
If you want to publish specific data, use the ASSIGN action.
- MaxRows
-
This property is the maximum number of rows to retrieve.
The default is 100.
- TimeoutSec
- The number of seconds until the query times out. The default is 10. The maximum number of seconds supported is 30 (though larger numbers can actually be entered in the field).
Branches
- Default
- The Default branch condition will be used unless another branch condition is met.
- OnNoRecords
- When data is not returned from the database, this branch condition is triggered.
- OnError
- When the SQL Query is invalid, this branch condition is triggered. Error Handling is a best practice.
- OnTimeout
- When the number of timeout seconds is reached, this branch condition is triggered.
Tips and Tricks
- This action will return all rows as an array.
- Use SQLTABLE for the same purpose as SQLSELECT when multiple rows are expected. Like the SQLSELECT action, column values are stored in variables with the same names as the column names. In this action, however, more than one record may be stored in each column variable. Each record is separated by the character defined in the Row Separator property. If the default pipe symbol (|) is used, each column can be referenced as an array.
- SQL databases do not guarantee any kind of ordering when you do not explicitly sort the data.
- Be careful not to select a large amount of data. This will ultimately cause the script to fail. If sequential access to a large table is required, see the SQLCURSOR action.