日期:2014-05-17 浏览次数:20591 次
declare @id int,@tsql varchar(6000)
declare ap scroll cursor for
select id from [表名] where [条件]
open ap
fetch first from ap into @id
while(@@fetch_status<>-1)
begin
select @tsql='exec [存储过程名] @id='+rtrim(@id)
exec(@tsql)
fetch next from ap into @id
end
close ap
deallocate ap