Click or drag to resize

SA0207 : Setting ANSI_NULLS to OFF is deprecated

The topic describes the SA0207 analysis rule.

Message

Setting ANSI_NULLS to OFF is deprecated

Description

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;

Scope

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

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

New Rules, Deprecated Features

Additional Information
Example Test Script
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

Analysis Results

 MessageLineColumn
1SA0207 : Setting ANSI_NULLS to OFF is deprecated.126
2SA0207 : Setting ANSI_NULLS to OFF is deprecated.134
3SA0207 : Setting ANSI_NULLS to OFF is deprecated.194
See Also

Other Resources