Code Analysis


Old-style column alias via EQUALS sign

The method of using the EQUALS sign to assign an alias to the column of a result is legal syntax only in Sybase and SQL Server, so it is not portable to other SQL Database systems such as Oracle or MySQL. We recommend that you follow the ANSI-SQL92 standard of assigning aliases using the AS keyword. You should delimit the alias with double quotes if it is not a standard identifier, although SQL Server allows use of square brackets. Microsoft has deprecated the use of single quotes to delimit an alias (see DEP021).

So, for example, SQL Prompt will raise a violation of ST002 for statements such as the following:

SELECT 'My Tables' = Schema_Name(schema_id)+'.'+[name] FROM sys.tables

This code will also raise DEP021.

For further details and examples, please see this Product Learning article: SQL Prompt code analysis: avoid non-standard column aliases (ST002 and DEP021).

Available in

SQL Prompt

SQL Code Guard

Didn't find what you were looking for?