Alias vs Assignment operator

  • Is there any functional or practical reason to prefer a column alias using "AS" vs using the assignment operator?

    for example,

    SELECT combined = col_A + col_B FROM Table

    vs

    SELECT col_A + col_B AS combined FROM Table

  • Never used the assignment operator. Convention seems to be

    SELECT col_A + col_B AS combined

    FROM Table

    or

    SELECT col_A + col_B 'combined'

    FROM Table

    Not sure it matters, but I might stick with the AS since it's what is most common.

  • Bascially one (AS clause) is ISO compliant and the equal-sign is not. According to BOL:

    The AS clause is the syntax defined in the ISO standard for assigning a name to a result set column. This is the preferred syntax to use in SQL Server.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply