Click or drag to resize

SA0163B : Setting ANSI_PADDING to OFF is deprecated

The topic describes the SA0163B analysis rule.

Message

Setting ANSI_PADDING to OFF is deprecated

Description

The rule checks T-SQL code for setting ANSI_PADDING or ANSI_DEFAULTS options set to OFF.

In a future version of Microsoft SQL Server ANSI_PADDING 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_PADDING is set at execute or run time and not at parse time.

To view the current setting for this setting, run the following query.

SQL
1DECLARE @ANSI_PADDING VARCHAR(3) = 'OFF';
2IF ( (16 & @@OPTIONS) = 16 ) SET @ANSI_PADDING = 'ON';
3SELECT @ANSI_PADDING AS ANSI_PADDING;

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

Design Rules

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
1SA0163B : Setting ANSI_PADDING to OFF is deprecated.326
2SA0163B : Setting ANSI_PADDING to OFF is deprecated.1128
3SA0163B : Setting ANSI_PADDING to OFF is deprecated.154
4SA0163B : Setting ANSI_PADDING to OFF is deprecated.194
See Also

Other Resources