Use the Export to data table
action to retrieve records from the database and store the retrieved data in
a table variable.
Procedure
To automate the task of selecting and saving a set of records, follow these
steps:
-
Enter the name of the session you used to connect to the database server in
the Connect
action.
You do not have to provide the details of the database
server here because you have already associated those details with the session
name when using the Connect action.
-
Enter the SELECT statement to specify the column and table names.
This field supports SQL syntax. For example, SELECT CustomerName,City
FROM Customers
Note: CTE (Common Table Expression) is supported using
WITH
keyword in the SQL compliant databases. For
example, WITH customers_in_usa AS (SELECT CustomerName, state FROM
customers WHERE country = 'USA') SELECT cName FROM customers_in_usa
WHERE state = 'LA' ORDER BY CustomerName
-
Enter the maximum number of records to
retrieve.
- Optional:
Enter a timeout value.
When the specified time expires, the statement execution stops even if the
execution is not completed.
-
In the Assign to option, select the table variable to store
the retrieved data.
Note:
If the data table has some existing values, the new table overrides the
existing data table. For example, if you use Export to
table
action twice in a bot with different select
queries, the last used Export to table
action will override the existing table.
-
Click Save.