SQL Select a row and store in a SQL variable

后端 未结 3 1605
伪装坚强ぢ
伪装坚强ぢ 2021-02-05 06:16

So, I\'m writing this Stored Proc and I really suck at SQL.

My Question to you guys is:

Can I select an entire row and store it in a variable?

I k

3条回答
  •  野性不改
    2021-02-05 06:44

    You could create a table variable that matches your table schema and store the single row in it:

    declare @myrow table(field0 int,field1 varchar(255))
    insert into @myrow
    select field0,field1 from mytable where field0=1
    

提交回复
热议问题