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.
To suppress warnings, set SQL_NOTES=0.
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 to Suppress the Message. If you want to suppress this message, then you can use the “SET NOCOUNT” statement.
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.
See SET ANSI_WARNINGS {ON | OFF}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With