Connecting Tech Pros Worldwide Help | Site Map

Re: problem with column alias

Plamen Ratchev
Guest
 
Posts: n/a
#1: Jul 27 '08
You cannot use a column alias in the definition of another column. The
solution is as you found to repeat the expression. Alternative solution is
to define the first column in one CTE (or derived table) and then use the
column in a second CTE.

Also, it is good to define a valid column name (not a revered keyword) and
then change it to whatever you want in the final SELECT (or client
application).


Plamen Ratchev
http://www.SQLStudio.com

Jan Hudecek
Guest
 
Posts: n/a
#2: Jul 27 '08

re: Re: problem with column alias


On 27 Čec, 23:06, "Plamen Ratchev" <Pla...@SQLStudio.comwrote:
Quote:
You cannot use a column alias in the definition of another column. The
solution is as you found to repeat the expression. Alternative solution is
to define the first column in one CTE (or derived table) and then use the
column in a second CTE.
>
Also, it is good to define a valid column name (not a revered keyword) and
then change it to whatever you want in the final SELECT (or client
application).
>
Plamen Ratchev
Thank you, you're probably right about that keyword..
Jan
Closed Thread


Similar Microsoft SQL Server bytes