Saturday, January 19, 2013 9:55 AM
declare @Date as datetime declare @c as int select @Date='01/17/2013' select @c = PD.copies as 'PD_COPIES' from PHeader PH inner join PDetailsPD on PH.Po_id=Pd.PD_Po_id
Hi what s wrong here
here i am getting error 'Incorrect syntax near the keyword 'as'.
Saturday, January 19, 2013 10:08 AM
select @c = PD.copies from PHeader PH inner join PDetailsPD on PH.Po_id=Pd.PD_Po_id
Saturday, January 19, 2013 1:22 PM
When assiging a value to a variable the variable already has a name , since the action is assigning a value and not output you cant give the variable an alias
Jayanth Kurup - www.enabledbusiness.com
- Proposed As Answer by Olaf HelperMicrosoft Community Contributor Sunday, January 20, 2013 8:47 AM
Sunday, January 20, 2013 5:06 AMModerator
If you're using a scalar variable to return the result you need to remove AS AliasName part from your query, e.g.
For every expert, there is an equal and opposite expert. - Becker's Law