cancel
Showing results for 
Search instead for 
Did you mean: 

dbisqlc Logging Options

Former Member
6,299

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.

Accepted Solutions (1)

Accepted Solutions (1)

johnsmirnios
Participant

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.

VolkerBarth
Contributor
0 Kudos

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.

Answers (1)

Answers (1)

johnsmirnios
Participant

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.

VolkerBarth
Contributor
0 Kudos

@John: Is that a documented feature? - I've never been aware of that:)

johnsmirnios
Participant
0 Kudos

The features of dbisqlc are no longer documented as dbisqlc has been replaced by the Java version. I'll post the relevant section from the dbisqlc documentation as another answer since comments here are limited in size.

Former Member
0 Kudos

John, much appreciated. Great information to be used in many circumstances. Thanks!