Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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.

like image 308
AR. Avatar asked Aug 14 '09 22:08

AR.


People also ask

How do I suppress warnings in SQL?

To suppress warnings, set SQL_NOTES=0.

How to SET ANSI_ WARNINGS OFF SQL Server?

You can use the user options option of sp_configure to set the default setting for ANSI_WARNINGS for all connections to the server. For more information, see sp_configure (Transact-SQL). ANSI_WARNINGS must be ON when you are creating or manipulating indexes on computed columns or indexed views.

How do I suppress a message in SQL Server?

How to Suppress the Message. If you want to suppress this message, then you can use the “SET NOCOUNT” statement.

What is the use of set Arithabort on in SQL Server?

SET ARITHABORT must be ON when you're creating or changing indexes on computed columns or indexed views. If SET ARITHABORT is OFF, CREATE, UPDATE, INSERT, and DELETE statements on tables with indexes on computed columns or indexed views fail.


1 Answers

See SET ANSI_WARNINGS {ON | OFF}

like image 56
Remus Rusanu Avatar answered Oct 02 '22 17:10

Remus Rusanu