tsql - SQL Server 2008: Fill multiple T-SQL variables from one SELECT query? -


to fill 1 variable value query can write following:

set @targetid = (select top 1 id @bigdataset order date desc) 

to fill multiple variables query, eg. like:

set (@targetid, @targetname) = ....(select top 1 id, [name] @bigdataset order date desc) 

what can write?

select top (1) @targetid=id, @targetname=name  @bigdataset  order date desc 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -