Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
发生错误后停止执行SQL脚本_Sql_Sql Server_Windows_Batch File - Fatal编程技术网

发生错误后停止执行SQL脚本

发生错误后停止执行SQL脚本,sql,sql-server,windows,batch-file,Sql,Sql Server,Windows,Batch File,我正在使用批处理文件执行多个SQL脚本,但如果其中任何一个脚本中出现错误,我希望停止批处理文件的执行 这是我的批处理文件: sqlcmd -S dbdev026b\dbdev026b -i c:Test1.sql -o c:\o1.txt sqlcmd -S dbdev026b\dbdev026b -i c:Test2.sql -o c:\o2.txt sqlcmd -S dbdev026b\dbdev026b -i c:Test1.sql -o c:\o1.txt || exit /b 1

我正在使用批处理文件执行多个SQL脚本,但如果其中任何一个脚本中出现错误,我希望停止批处理文件的执行

这是我的批处理文件:

sqlcmd -S dbdev026b\dbdev026b -i c:Test1.sql -o c:\o1.txt
sqlcmd -S dbdev026b\dbdev026b -i c:Test2.sql -o c:\o2.txt
sqlcmd -S dbdev026b\dbdev026b -i c:Test1.sql -o c:\o1.txt || exit /b 1
sqlcmd -S dbdev026b\dbdev026b -i c:Test2.sql -o c:\o2.txt || exit /b 2