SA0156 : Statements CREATE/DROP DEFAULT are deprecated. Use DEFAULT keyword in CREATE/ALTER TABLE

The topic describes the SA0156 analysis rule.

Message

Statements CREATE/DROP DEFAULT are deprecated. Use DEFAULT keyword in CREATE/ALTER TABLE

Description

The rule checks for usage of the deprecated CREATE/DROP DEFAULT statements.

This feature will be removed in a future version of Microsoft SQL Server.

.

How to fix

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

Instead, use default definitions created using the DEFAULT keyword of ALTER TABLE or CREATE TABLE

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
13 minutes per issue.
Categories

Design Rules, Deprecated Features, Code Smells

Additional Information
Example Test SQL
SQL
1--DROP DEFAULT  phonedflt;
2CREATE DEFAULT phonedflt AS 'unknown';

Analysis Results
  Message Line Column
1 SA0156 : Deprecated CREATE/DROP DEFAULT statement. Use DEFAULT keyword in CREATE/ALTER TABLE. 2 1
See Also

Other Resources