SA0157 : Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior

The topic describes the SA0157 analysis rule.

Message

Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior

Description

The rule checks for usage of single part or two part column names in SELECT, UPDATE, DELETE, INSERT and MERGE statements.

The usage of three- or four-part column names in queries is deprecated.

How to fix

It is recommended to change the query to use the standard-compliant two-part names.

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

Design Rules, Naming Rules, Deprecated Features, Code Smells

Additional Information
Example Test SQL
SQL
 1SELECT 
 2       *,Database1..Table4.Column1
 3FROM 
 4     ..Table1,
 5     Schema1.Table2, Database1..Table3
 6     INNER JOIN Database1..Table4   
 7        ON Database1..Table4.Column1=Database1..Table3.Column1 AND 
 8           Database1..Table4.Column2= Schema1.Table1.Column2
 9     INNER JOIN Database1.Schema2.Table4 ON 
10           Database1..Table2.Column1=Database1..Table3.Column1 AND 
11           Database1..Table2.Column2=Database1.Schema1.Table1.Column2
12WHERE 
13      Database1.Schema1.Table1.Column1= Schema1.Table2.Column1 AND 
14      Database1.Schema1.Table3.Column1=Database1.Schema1.Table2.Column3  /*IGNORE:SA0157(LINE)*/

Analysis Results
  Message Line Column
1 SA0157 : Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior. 2 9
2 SA0157 : Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior. 7 11
3 SA0157 : Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior. 7 37
4 SA0157 : Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior. 8 11
5 SA0157 : Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior. 8 38
6 SA0157 : Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior. 10 11
7 SA0157 : Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior. 10 37
8 SA0157 : Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior. 11 11
9 SA0157 : Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior. 11 37
10 SA0157 : Usage of three and four part column names is deprecated. Two-part names is the standard-compliant behavior. 13 6
See Also

Other Resources