skip to main content
Configuring the ODBC Client : Using Interactive SQL for ODBC : Redirecting Output from Interactive SQL (ODBC)
 

Redirecting Output from Interactive SQL (ODBC)

Interactive SQL (ODBC) can be easily used from other processes to execute SQL commands to retrieve results, using redirection to execute. This is facilitated by having Interactive SQL (ODBC) output its results and errors to stdout and stderr respectively:
*All results, including the column names and the output values, are sent to the stdout.
*An error in executing a query is sent to stderr.
For example, the following command executes queries from a test.sql file and sends the outputs to output.txt and errors to errors.txt:

odbcisql -c test.sql > output.txt 2> errors.txt