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.

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;

How to fix

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

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

Design Rules, 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 SA0163B : Setting ANSI_PADDING to OFF is deprecated. 3 26
2 SA0163B : Setting ANSI_PADDING to OFF is deprecated. 11 28
3 SA0163B : Setting ANSI_PADDING to OFF is deprecated. 15 4
4 SA0163B : Setting ANSI_PADDING to OFF is deprecated. 19 4
See Also

Other Resources