サイラスの本棚
2012-07-27
[SQL]ストアドでFETCHを記述する方法
SET XACT_ABORT ON Begin Tran DECLARE general_cursor CURSOR FOR SELECT C.foo, C.bar, C.baz FROM T_Hoge AS C OPEN general_cursor declare @Foo float declare @Bar float declare @Baz float FETCH NEXT FROM general_cursor INTO @Foo,@Bar,@Baz WHILE @@FETCH_STATUS = 0 BEGIN -- 処理 FETCH NEXT FROM general_cursor INTO @Foo,@Bar,@Baz END CLOSE general_cursor DEALLOCATE general_cursor Commit Tran