sql server 2005 - SQL Select a row and store in a SQL variable -


so, i'm writing stored proc , suck @ sql.

my question guys is:

can select entire row , store in variable?

i know can like:

declare @someinteger int select @someinteger = (select someintfield sometable somecondition) 

but can select entire row sometable , store in variable?

you can select fields multiple variables:

declare @a int, @b int  select   @a = col1,   @b = col2 sometable ... 

another, potentially better, approach use table variable:

declare @t table (   int,   b int ) insert @t ( a, b ) select   col1,   col2 sometable ... 

you can select table variable regular table.


Comments

Popular posts from this blog

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

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

openssl - Load PKCS#8 binary key into Ruby -