I have a batch file that runs some SELECT queries using sqlcmd, puts the results into text files, and uploads those files onto an FTP server. That\'s all working just the way it
You can check errorlevel returned from SQLCMD to see if it failed.
errorlevel
SQLCMD
sqlcmd -b IF ERRORLEVEL 1 goto err_handler goto done :err_handler REM handle the error here :done REM script completion code here