how to trap dos errorlevel when sqlcmd execution timout ?

  • Hello,

    I test %ERRORLEVEL% in a .bat file who execute sqlcmd -b -l 1 -t 1 ...

    but sqlcmd exits with success (dos errorlevel = 0) when execution time out !!!

    I test with options -m-1 and -V1 but it doesn't work.

     

    any idea how to trap dos errorlevel when sqlcmd execution timout ?

     

    Thanks,

     

    --

  • This was removed by the editor as SPAM

  • I realize this is very old, but this is still unanswered. Anyone know the solution to this?

  • Hi,

    Not tried it by myself but may be useful to you:

    sqlcmd <yourscript>

    IF ERRORLEVEL 1 goto err_handler

    goto done

    :err_handler

    REM handle the error here

    :done

    REM script completion code here

    Ref: http://stackoverflow.com/questions/5795430/error-handling-with-batch-file-sqlcmd

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply