I have a query (in sp) which takes long time to Execute :
e.g.
Select name, age ,token1 from Mytable where id=2 //long calc....
//later on the same sp...
select anotherCalc from Table2 where tokenId=token1 // token1 is from the prev query.
How can i pass the value from 1st query to the second ?
Ive tried :
declare @tmp int
Select name, age ,@tmp=token1 from Mytable where id=2
but its not working…
You can’t mix a
selectthat assigns to variables with one that returns results. If the first query only returns at most one row you can use