Hello,
Is there a way to assign multiple variables to one select statement as in the following example?
DECLARE @.FirstName VARCHAR(100)
DECLARE @.MiddleName VARCHAR(100)
DECLARE @.LastName VARCHAR(100)
@.FirstName, @.MiddleName, @.LastName = SELECT FirstName, MiddleName, LastName FROM USERS WHERE username='UniqueUserName'
I don't like having to use one select statement for each variable I need to pull from a query. This is in reference to a stored procedure.
Thank you!
Cody
Hi, you can use the below syntax.
SELECT
@.FirstName = FirstName,
@.MiddleName = MiddleName,
@.LastName = LastName
FROM USERS
WHERE username = 'UniqueUserName'
Eralper
http://www.kodyaz.com
No comments:
Post a Comment