Home Forums SQL Server 2005 Development how to trap dos errorlevel when sqlcmd execution timout ? RE: how to trap dos errorlevel when sqlcmd execution timout ?

  • 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