Subject Uses of named s aka aliases
Author Ann W. Harrison
> Arno Brinkman wrote:

>
>>If i run this in MSSQL :
>>
>>SELECT ID, RELATIEID AS ALIAS
>> FROM Orders
>> WHERE ALIAS = 3668
>>
>>it fails with: Invalid column name 'ALIAS'.
>>
>>AFAIK it only support aliasses in the ORDER BY clause and NOT in the WHERE,
>>GROUP BY, HAVING clauses.

A glance at the standard suggests that X AS Y in the select list is
called <derived column> AS <column name>. The restrictions on the use
of a <derived column> appear to be:


64) Specifications for Feature F441, “Extended set function support”:
a) Subclause 7.8, “<where clause>”:
i) Without Feature F441, “Extended set function support”,
conforming SQL language shall not contain a <value expression>
directly contained in a <where clause> that contains a
<column reference> that references a <derived column> that
generally contains a <set function specification> without an
intervening <routine invocation>.


33) Subclause 14.3, “<fetch statement>”:
d) It is implementation-dependent whether CR remains positioned on
the current row when an exception condition is raised during
the derivation of any <derived column>.