1

選択クエリから宣言された変数に値を格納したいのですが、ここでの問題は、選択クエリが複数の行を返すことです。以下の例を参照してください

select Col1
from Table1 where Col1 NOT IN (select Col1 from Table2) 
and Col3 >=8


------------------
result
73
74

declare @temp1 int
declare @temp2 int

I essentially want @temp1 to hold 73 and @temp2 hold 74 and so fort...

これを達成する方法についてのアイデアは非常に役立ちます。さらに説明が必要な場合はお知らせください。

前もってありがとう、ガガン

4

2 に答える 2

1

カーソルを探していると思います。

これは素晴らしいリンクです。

于 2013-05-07T11:22:39.437 に答える