SQL Command Process

Use the SQL Command API process to automate SQL scripts, which is helpful in exporting data or running SQL scripts on data.

Process Settings

Below are the settings you must define for the SQL Command API process.

Setting Description Sample Value
ProcessIDThis setting informs Cobra to run the SQL Command process. SQLCommand
SQLCommandThis setting refers to the SQL command that runs during the API process. It can either be a one-line SQL command or a file containing a SQL script.

If you specify a SQL script file containing the desired statements, Cobra checks if the file exists. If it does, Cobra loads and runs the file; otherwise, Cobra directly executes the specified SQL statement.

This setting is required.

C:\ProjectFiles\Deltek\Cobra\sqlexample.sql
SaveAsFileThis setting refers to the full path and filename of the data exported after the command runs.

This setting is required only for SELECT commands. It is optional and, by default, is configured not to save.

The supported file formats are .xlsx, .xls, and .csv. If you do not specify a file format, Cobra defaults to .csv. In addition, if you do not specify a filename, the selected data is saved as SQLResults (for example, SQLResults.csv). If you do not specify a directory, the selected data is saved in <Documents\Deltek\Cobra>.

If the SaveAsFile setting is defined in the API script file and includes SET commands with autosave, the SaveAsFile setting takes precedence over the path specified in the SET commands for the file path.

C:\ProjectFiles\Deltek\Cobra\

System\sqlexample.csv

If the query results to be saved contain more than the maximum row limit, Cobra truncates the results and displays the following message in the process log: "The saved results data in file ‘Table.xlsx’ exceeded <MAX_LENGTH> row limit for specified format and it was truncated."

Sample Script

Below is a sample script file for the SQL Command API process.

[Process020]
ProcessID=SQLCommand
SQLCommand=C:\ProjectFiles\Deltek\Cobra\sqlexample.sql
SaveAsFile=C:\ProjectFiles\Deltek\Cobra\System\sqlexample.csv