Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2003

    Unanswered: Exiting isql on error

    Is there anyway to get a script to stop running if an error occurs. In microsft sql server running isql with the -b paramter does this but in sybase the -b parameter disables the display of the table headers output.

  2. #2
    Join Date
    Feb 2002
    Willy is on vacation
    isql has a -m parameter with which you can customize the errorlevel that you want to be visible.

    Other than that all errors as matter of fact stop the query running, unless they are warnings.

  3. #3
    Join Date
    Feb 2003
    The docco says this about the -m paramter

    -m errorlevel

    customizes the error message display. For errors of the severity level specified or higher, only the message number, state, and error level are displayed; no error text appears. For error levels lower than the specified level, nothing appears.

    Ive tried running the isql with -m1 and -m0 however I still recieve error messages during the script run without it "bombing out". Even the unix return code seems to be 0.

  4. #4
    Join Date
    Mar 2009
    Montreal (Canada)

    6 years later... and still the same questions ;)

    I basically have the same question regarding the isql return code to UNIX.

    My unix script is running a sybase SQL script using this command line:

    isql -u... -p... -s... -d... -w999 -n -iSQLscript.sql

    the SQLscript.sql is creating a SP and runinng it.

    For testing purposes, the SP fails and return some error message like this one:
    Msg 99999, Level 16, State 1:
    Server 'xyz', Proc 'SP_blabla', line 123:
    SP_blabla: some error message
    (return status = 99999)

    Now, back in Unix, the return code of the iSQL command is still 0 !
    I want it to report failure!!!

    In ORACLE, I would have write "WHENEVER SQLERROR EXIT FAILURE ROLLBACK" in the sql script.

    For some resons, I can't have sybase isql to report an error to the calling script in Unix.

    Please help!


  5. #5
    Join Date
    May 2005
    South Africa
    Provided Answers: 1
    You can get a sql script to stop running with
    select syb_quit()
    I don't know how to pass a code to the OS, guess you'll have to grep the log file for Msg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts