/ /ストアドプロシージャをバッチで実行する必要があります - sql-server-2008

ストアドプロシージャをバッチで実行する必要があります - sql-server-2008

私はテーブル内の2000行以上を更新する手続きを持っています。

プロシージャを一括して実行する必要があります。最初の10行、次の10行などを実行します。私はそれについてどうやって行ってください。

回答:

回答№1は0

何かのようなもの:

declare @id int
declare c cursor for
select top 10 id
from table
where (needs updating) = 1

open c
fetch next from c into @id
while @@fetch_status = 0
begin

update table
set
(needs to be set) = (value to set),
(needs updating) = 0
where id = @id

fetch next from c into @id

end