当前位置: 代码迷 >> Sql Server >> 关于存储过程中循环调用存储过程的有关问题.感谢
  详细解决方案

关于存储过程中循环调用存储过程的有关问题.感谢

热度:342   发布时间:2016-04-27 19:52:33.0
关于存储过程中循环调用存储过程的问题.感谢!
有表table1,过程proc1
如何把table1中的field1,[email protected],@b?不知这个循环语句如何写.感谢!!!

----select   field1,field2   from   table1
----exec   proc1   @a=field1,@b=field2

------解决方案--------------------
declare @a ?类型, @b ?类型
declare curTest cursor for select field1,field2 from table1
open curTest
fetch next from curTest into @a,@b
while @@fetch_status = 0
begin
exec proc1 @a,@b
fetch next from curTest into @a,@b
end
close curTest
deallocate curTest
  相关解决方案