SA0208 : Setting CONCAT_NULL_YIELDS_NULL to OFF is deprecated

The topic describes the SA0208 analysis rule.

Message

Setting CONCAT_NULL_YIELDS_NULL to OFF is deprecated

Description

The rule checks T-SQL code for setting CONCAT_NULL_YIELDS_NULL option to OFF.

In a future version of Microsoft SQL Server CONCAT_NULL_YIELDS_NULL will always be ON and any applications that explicitly set the option to OFF will produce an error.

How to fix

Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

The setting of SET CONCAT_NULL_YIELDS_NULL 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 @CONCAT_NULL_YIELDS_NULL VARCHAR(3) = ‘OFF’;

IF((4096 & @@OPTIONS) = 4096 ) SET @CONCAT_NULL_YIELDS_NULL = ‘ON’;

SELECT @CONCAT_NULL_YIELDS_NULL AS CONCAT_NULL_YIELDS_NULL;

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.

Effort To Fix
20 minutes per issue.
Categories

Deprecated Features, Bugs

Additional Information
Example Test SQL
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
  Message Line Column
1 SA0208 : Setting CONCAT_NULL_YIELDS_NULL to OFF is deprecated. 7 4
2 SA0208 : Setting CONCAT_NULL_YIELDS_NULL to OFF is deprecated. 11 4
3 SA0208 : Setting CONCAT_NULL_YIELDS_NULL to OFF is deprecated. 17 4
See Also

Other Resources