Reputation: 43
The code below works. Can this be improved?
declare @rlcstallname varchar(50), @rlcsalesdept varchar(50), @rlcpath varchar(50)
set @rlcstallname = (select stallname from sometable)
set @rlcsalesdept = (select salesdept from sometable)
set @rlcpath = (select [path] from sometable)
I need to know how to get the three values I store into the variables using only one select statement; I find executing 3 select statements excessive.
Thanks
Upvotes: 4
Views: 5097
Reputation: 31879
SELECT
@rlcstallname = stallname,
@rlcsalesdept = salesdept,
@rlcpath = [path]
FROM sometable
Upvotes: 10