I have something like this
declare @foo bigint;
declare @bar nvarchar(20);
set @foo = select foo from theTable where id = 37;
set @bar = select bar from theTable whre id = 37;
is it possible to do this with a single select ?
I have something like this
declare @foo bigint;
declare @bar nvarchar(20);
set @foo = select foo from theTable where id = 37;
set @bar = select bar from theTable whre id = 37;
is it possible to do this with a single select ?
Yes, you can do this in a single sql query using:
SELECT @bar = bar, @foo = foo from theTable whre id = 37;
This is not possible if you use the SET command .. but if you use SELECT, you can do it.
SELECT @foo = foo, @bar = bar FROM theTable where id = 37