Stop SQL Server Management Studio from adding ANSI_NULLS and QUOTED_IDENTIFIER

How can I prevent SQL Management Studio (10.50.2500.0) from adding this to the beginning of each stored procedure when right-clicking / Modify?

SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO 

None of these options suit me. ANSI_NULLS ON and QUOTED_IDENTIFIER ON are installed on all my servers, DBs and connections that I make. Also, I never use double quotes (I used brackets for reserved words) and all my fields with null values, which I use correctly if necessary NULL.

I delete the settings every time I edit the procedure. All my procedures properly install them, and that will never change in my environment. Checked by:

 SELECT uses_ansi_nulls, uses_quoted_identifier FROM sys.sql_modules WHERE object_id = object_id( 'proc_name' ) 
+8
sql-server sql-server-2008 ssms sql-server-2008-r2
source share
1 answer

Not sure if this counts as an answer or a useless non-answer, but as Damien_The_Unbeliever suggested , you absolutely don't want SSMS to stop writing these lines . Because they are in the sql_modules table, they form an integral part of the stored procedure definition, as well as the SQL code itself. Thus, they cannot be β€œdisabled” anymore than your SQL code.

If you create / modify a stored procedure from a connection with another value of the ANSI_NULLS parameter, which is used to create / define a stored procedure, then you constantly change the behavior of this stored procedure!

It is for this reason that SSMS (and any semi-decent SQL object scripting tool) will always output these lines - because if you delete them or change them, you will change the definition of the stored procedure (deleting them, in particular, is bad, because it means that the behavior of a stored procedure, depending on which connection it is published from, can change).

When doing a google quick search for the β€œANSI_NULLS QUOTED_IDENTIFIER stored procedure", the best result is the following article, which seems to explain the parameters and their effect very clearly: http://ranjithk.com/2010/01/10/understanding-set-quoted_identifier -onoff /

+7
source share

All Articles