sql - Select and assign to variable in one statement? -
i'd display results of query, , i'd capture column's value @ same time. from
, where
same in both queries. can both in 1 query, or easier/better query twice, this?
declare @fooid int set @fooid = (select fooid bar snuhid = 5) select * bar snuhid = 5
unfortunately has done in 2 operations.
test:
declare @var datetime select @var=getdate(), getdate()
yields error message 141.
Comments
Post a Comment