Create file from SQL results

Last published at: May 2nd, 2023

Description:

Executes an SQL query against the selected database and return the results in file.

Inputs

  • name - step name
  • connectionString – connection string to the database
  • sqlQuery – SQL query to execute
  • resultFileFormat – return results in selected file format
  • varGlobalFilePath - Specifies the file path for the output
  • changeDatabase - connect to different Database

Returns

  • True – SQL query executed successfully
  • False – SQL query failed to execute

Usage:

Example:

Let’s build and execute the querytofileDef example.          

  • Create a new definition called “querytofileDef
  • Select the definition and click the “design” button
  • Drag a querytofile step from the toolbox
  • Connect the dots between the start and querytofile step
  • Click on the “querytofile” step to configure its properties
  • Configure the following values for the properties as shown on the below graphic
  • Save the process definition, create a process instance and execute. The step should create file from SQL results. 
  • The column headers in the output excel file matches the columns specified in the SQL query with regards to text case.