Using the Read from ação

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:

  1. 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.
  2. 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
    
  3. Enter the maximum number of records to retrieve.
  4. 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.
  5. 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.
    1. Select the file path from the Bots folder, the local device, or an existing file variable.
    2. Select the CSV file encoding to be either ANSI, UNICODE, or UTF8.
    3. 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
    4. Select this check box if you do not want a CSV file to be created when the SQL query does not return any data.
    5. Specify whether to overwrite the file or append the data to the existing file if a CSV file with the same name exists.
  6. Click Save.