When running a sql script through command prompt/dbisqlc as below: dbisqlc -c "dsn=[whatever]" c:\temp\runthiscript.sql with SET TEMPORARY OPTION ON_ERROR = 'CONTINUE'; included in the script, is there a way to log or capture the information from the messages pane? I would be running updates, deleted, or inserts and am interested in capturing any foreign key errors for follow up. |
From the v5.5 dbisqlc documentation: Output redirection can be used to export data as an alternative to the OUTPUT statement. The output of any command can be redirected to a file or device by putting the ># redirection symbol anywhere on the command. The redirection symbol must be followed by a file name, as follows:
Output redirection is most useful on the SELECT statement. The SET OUTPUT_FORMAT command can be used to control the format of the output file. Example The >& redirection symbol redirects all output including error messages and statistics for the command on which it appears. For example: SELECT * FROM employee >& filename outputs the SELECT statement to the file, followed by the output from the SELECT statement and some statistics pertaining to the command. The >& redirection is useful for getting a log of what happens during a READ command. The statistics and errors of each command are written following the command in the redirected output file. If two > characters are used in a redirection symbol instead of one (>>#, >>&.), then the output is appended to the specified file instead of replacing the contents of the file. For output from the SELECT command, headings are output if and only if the output starts at the beginning of the specified file and the output format supports headings. Comment Text Removed
Wow, thanks for the pointer to "Output redirection" - and it's not only documented in V5.5 (whose topic I have obviously overseen although I have used that version quite a lot) but in all newer versions including V12, too: cf. http://dcx.sybase.com/index.html#1200en/dbusage/loexout.html. |