SA0235 : Consider using the AS keyword to specify a column alias instead of the column_alias = expression syntax |
![]() |
Using column_alias = expression syntax may reduce readability and does not align with the ANSI SQL standard, which recommends the AS keyword for column aliasing.

Using column_alias = expression syntax in T-SQL scripts may lead to confusion and poor readability. Although this syntax is legal in SQL Server, it does not conform to the SQL ANSI standard, which suggests using the AS keyword for aliasing columns.
For example:
1-- Example of problematic query using assignment operator for aliasing 2SELECT column1 = expression1 3FROM TableName;
The example above can be misleading because it resembles variable assignment rather than simple aliasing. It is not easily recognizable to those familiar with standard SQL conventions, making it harder to maintain consistency across different RDBMS systems.
-
Decreases readability and increases potential for misunderstanding among team members who expect standard syntax.
-
May lead to compatibility issues when migrating code to different systems that adhere strictly to ANSI SQL.

Use the AS keyword for column aliasing to improve readability and maintain SQL ANSI standard compliance.
Follow these steps to address the issue:
-
Identify any instances in your T-SQL queries where the column_alias = expression syntax is used.
-
Replace the format column_alias = expression with expression AS column_alias.
-
Ensure that all team members are aware of the change and adhere to using the AS syntax for consistency and readability.
For example:
1-- Problematic query using assignment operator for aliasing 2SELECT column1 = expression1 3FROM TableName; 4 5-- Corrected query using AS keyword for aliasing 6SELECT expression1 AS column1 7FROM TableName;

The rule has a Batch scope and is applied only on the SQL script.

Rule has no parameters.

The rule does not need Analysis Context or SQL Connection.


Design Rules, Code Smells

There is no additional info for this rule.

SQL
1-- OK 2SELECT au_id+au_id AS alias_for_col 3FROM dbo.authors 4 5-- OK 6SELECT au_id+au_id AS [alias_for_col] 7FROM dbo.authors 8 9-- OK 10SELECT au_id+au_id AS "alias_for_col" 11FROM dbo.authors 12 13-- OK 14SELECT au_id+au_id AS 'alias_for_col' 15FROM dbo.authors 16 17-- OK 18SELECT column_alias=expression 19FROM dbo.authors 20 21-- column_alias = expression syntax is used here, but ignored, because all rules at the violation line are suppressed. 22SELECT alias_for_col=au_id+au_id, au_id --IGNORE:*(LINE) 23FROM dbo.authors 24 25 26-- Deprecated alias syntax is used here. Reported by SA0008 27SELECT 'alias_for_col'=au_id+au_id 28FROM dbo.authors 29 30DECLARE @variable int 31SELECT @variable = 1 |

Message | Line | Column | |
---|---|---|---|
1 | SA0235 : Consider using the AS keyword to specify a column alias instead of the column_alias = expression syntax. | 18 | 23 |
