SA0207 : Setting ANSI_NULLS to OFF is deprecated |
![]() |
The topic describes the SA0207 analysis rule.

Setting ANSI_NULLS to OFF is deprecated

The rule checks T-SQL code for setting ANSI_NULLS option to OFF.
In a future version of Microsoft SQL Server ANSI_NULLS will always be ON and any applications that explicitly set the option to OFF will produce an error.

Avoid using this feature in new development work, and plan to modify applications that currently use this feature.
The setting of SET ANSI_NULLS is set at execute or run time and not at parse time.
To view the current setting for this setting, run the following query.
DECLARE @ANSI_NULLS VARCHAR(3) = ‘OFF’;
IF ( (32 & @@OPTIONS) = 32 ) SET @ANSI_NULLS = ‘ON’;
SELECT @ANSI_NULLS AS ANSI_NULLS;

The rule has a Batch scope and is applied only on the SQL script.

Rule has no parameters.

The rule does not need Analysis Context or SQL Connection.


Deprecated Features, Bugs


SQL
1ALTER DATABASE TestDb SET ANSI_NULLS OFF 2 3ALTER DATABASE TestDb SET ANSI_PADDING OFF 4 5ALTER DATABASE TestDb SET CONCAT_NULL_YIELDS_NULL OFF 6 7SET CONCAT_NULL_YIELDS_NULL OFF 8 9SET ANSI_PADDING ON 10 11SET CONCAT_NULL_YIELDS_NULL,ANSI_PADDING OFF 12 13SET ANSI_NULLS OFF 14 15SET ANSI_PADDING OFF 16 17SET CONCAT_NULL_YIELDS_NULL OFF 18 19SET ANSI_DEFAULTS OFF |

Message | Line | Column | |
---|---|---|---|
1 | SA0207 : Setting ANSI_NULLS to OFF is deprecated. | 1 | 26 |
2 | SA0207 : Setting ANSI_NULLS to OFF is deprecated. | 13 | 4 |
3 | SA0207 : Setting ANSI_NULLS to OFF is deprecated. | 19 | 4 |
