Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set two variables to receive SELECT results 1

Status
Not open for further replies.

chicdog

Programmer
Feb 28, 2002
84
US
Is it possible to set two variables to receive the result of a Select statement knowing that there will be ONLY one row returning.

SET @Var1, @Var2 = (Select A,B From tblTable Where
Key=3)

Thanks,
Bryan
 
Code:
Select @Var1=A, @Var2=B From tblTable Where 
           Key=3

You will need to declare @Var1 and @Var2 before doing this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top