Use the Read from
ação to retrieve records from the database and save the retrieved data in a
CSV file. This ação enables you to retrieve up to one million records from
the database.
Nota: In Automation 360, the bot
displays an error when you use Read from
ação to copy the table records using Select * into tablename from
sourcetable, whereas this functionality is supported in Enterprise 11. If you have such bots created in Enterprise 11 and migrated to Automation 360, we recommend
modifying your bots and use Insert/Update/Delete
ação to perform this operation.
Procedimento
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
ação.
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
Nota: CTE (Common Table Expression) is supported using
WITH
keyword in the SQL compliant databases such as
Oracle and MySQL. 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.
- Opcional:
Insira um valor de tempo limite.
Quando o tempo especificado terminar, a execução da instrução será interrompida mesmo que a execução não tenha sido concluída.
-
Select the Export data to CSV option to save the
retrieved data.
Nota: Currently, the option to change the delimiter when
exporting the data to a CSV file is not available.
-
Select the file path from the Bots folder, the
local device, or an existing file variable.
-
Select the CSV file encoding to be either ANSI,
UNICODE, or
UTF8.
-
Select whether to export the CSV file with or without the column
headers.
With column headers
CustomerName |
City |
Manny |
Pittsburgh |
Kate |
Los Angeles |
John |
Boston |
Without column headers
Manny |
Pittsburgh |
Kate |
Los Angeles |
John |
Boston |
-
Select this check box if you do not want a CSV file to be created when
the SQL query does not return any data.
-
Specify whether to overwrite the file or append the data to the
existing file if a CSV file with the same name exists.
-
Click Save.