New isql command line option --retserverror

You can use the new --retserverror option to force isql to terminate and return a failure code when it encounters a server error of severity greater than 10. In this type of abnormal termination, isql writes the label “Msg” together with the actual ASE error number to stderr, and returns a value of “2” to the calling program.

Syntax

isql --retserverror

Example

In this example, isql encounters a server error of severity 16. Since the --retserverror option is specified, isql returns “2” to the calling shell, prints “Msg 207” to stderr, and exits. As before, isql prints the full server error message to stdout. The same behavior applies to Windows, where you will find the return value of “2” in %ERRORLEVEL%:

guest> isql -Uguest -Pguestpwd -SmyASE --retserverror
       2> isql.stderr
1> select no_column from sysobjects
2> go
Msg 207, Level 16, State 4: 
Server 'myASE', Line 1: 
Invalid column name 'no_column'.

guest> echo $?
2
guest> cat isql.stderr
Msg     207
guest>