I want to pass the result of a query in a variable in sql server 2005 procedure.
Please guide.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rekha SinghPosted Jan 5, 2010, 8:20 AM
declare @var as nvarchar(50)
set @var = ( select name from test where id ='1')
print @var
@var is a variable which will have the query result
*********************************************
Pls mark Accepted if u find it helpful