on 2010 Dec 30 6:29 PM
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:
># filename
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
I don't think there is a way to log just the messages pane but you can log everything (include result sets from select statements) with the ">&" operator. If you are using it on a command line, you will need to quote it to so that it isn't interpreted as output redirection by the shell:
dbisqlc -c "..." read foo.sql ">&" output.txt
There is also a ">#" operator that only logs result sets (no messages) as well as ">>&" and ">>#" which append to the output file rather than create a new one.
-john.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
11 | |
10 | |
10 | |
10 | |
8 | |
7 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.