Click or drag to resize

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.

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.

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
1SA0208 : Setting CONCAT_NULL_YIELDS_NULL to OFF is deprecated.74
2SA0208 : Setting CONCAT_NULL_YIELDS_NULL to OFF is deprecated.114
3SA0208 : Setting CONCAT_NULL_YIELDS_NULL to OFF is deprecated.174
See Also

Other Resources