What is the Recommend/default settings for ANSI_NULLS and QUOTED_IDENTIFIER, should we leave both on?
ANSI_NULLS
should always be ON
. Always.
Here's why. From the documentation for SET ANSI_NULLS ON
:
In a future version of SQL Server, ANSI_NULLS will always be ON and any applications that explicitly set the option to OFF will generate an error. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.
As for QUOTED_IDENTIFIER
, that is more of an opinion-based question. I don't really care, because I never set the option explicitly, but if you do use it you should use it consistently everywhere. The reason I don't care is because I never quote identifiers with single or double quotes; I think this is very unreadable and makes them look like string:
SELECT 'alias' = "column" FROM "dbo"."table" AS 'alias';
Really? I much prefer using square brackets, and even then only when required (e.g. the identifier is a reserved word).
SELECT alias = [column] FROM dbo.[table] AS alias;
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