运行脚本 SQL Server 2005 时如何抑制 T-SQL 警告?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1280508/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 03:13:02  来源:igfitidea点击:

How do I suppress T-SQL warnings when running a script SQL Server 2005?

sqlsql-serversuppress-warnings

提问by AR.

Is it possible to suppress warnings generated by T-SQL scripts? If so, how?

是否可以抑制 T-SQL 脚本生成的警告?如果是这样,如何?

I know I can turn of the 'records affected' messages with

我知道我可以用

SET NOCOUNT ON

but is there an equivalent for warnings? Eg:

但是否有等价的警告?例如:

Warning: Null value is eliminated by an aggregate or other SET operation.

If I'm expecting these errors, it helps to sift the real errors from the chaff in a big script.

如果我预计会出现这些错误,那么在大脚本中从谷壳中筛选出真正的错误会有所帮助。

Thanks.

谢谢。