Refer to same Alias twice in same procedure?

  • Thread starter Thread starter Jay
  • Start date Start date
J

Jay

Hi,

Can anyone help me. Let's say I have an Alias field (resulting from a
calculation) in a stored procedure, how do I reference that alias again in
the same procedure?, assuming I want to use it in another calculation.

Any help greatly appreciated.....Rgds, Jason
 
Alias or local variable? For alias, the only what I know is to repeat the
expression or use a subquery:

Select (2.0/3), Q.A * Q.A from (select 2.0/3 as A) as Q

For the use of local variables, take a look at the documentation on T-SQL.
 
Back
Top