cmd /c sqlcmd -b -i script01.sql -S localhost -d master >script01.log
IF [%ERRORLEVEL%] NEQ [0] GOTO ERROR
ECHO Do Something
:ERROR
set exitstatus=1
ECHO ------------------------------------------------------------------
ECHO !!!!! ERROR OCCURRED !!!!!
ECHO ------------------------------------------------------------------
PAUSE
GOTO END
:END
ECHO %date% %time%
exit /b %exitstatus%
Comments