DF187: Unqualified column name is used in the SELECT list.
Last modified: December 25, 2024
The topic describes the DF187 T-SQL code analysis rule.
Category
BEST PRACTICE
Message
Unqualified column name is used in the SELECT list.
Description
It is recommended to fully specify column names with aliases to prevent ambiguity and improve readability.
Noncompliant code example
SELECT NAME COLLATE Latin1_General_100_BIN
FROM sys.columns
GO
SELECT Salary*2
FROM dbo.PersonnelSalary
GO
Compliant solution
SELECT NAME COLLATE Latin1_General_100_BIN AS Name
FROM sys.columns
GO
SELECT Salary*2 AS DoubledSalary
FROM dbo.PersonnelSalary
GO
SELECT FirstName /*result column name inherits source column name FirstName*/
FROM dbo.Personnel
GO
Was this page helpful?