sql-serveransi-sqlcolumn-alias

When was aliasing using "=" versus "as" introduced and what is the name of that version


When is the name of the flavor of sql that supports "=" for alias instead of using "as"?

SELECT 
 A = Col1
,B = Col2
FROM Table

as opposed to SQL-86

SELECT
  Col1 AS A
, Col2 AS B
FROM Table

Solution

  • This is of a great surprise to me. It seems that the column_alias = expression has always been part of the original syntax of T-SQL.

    The AS command was added to T-SQL.80 (2000) to be SQL-92 compatible.

    Excerpt of SQL2000_release.pdf page 1459

    The AS clause is the syntax defined in the SQL-92 standard for assigning a name to a result set column. This is the preferred
    syntax to use in Microsoft® SQL Server™.
    
    column_name AS column_alias
    
    Or
    
    result_column_expression AS derived_column_name
    
    Transact-SQL also supports the following syntax for compatibility with earlier versions of SQL Server:
    
    column_alias = column_name