关于存储过程中循环调用存储过程的问题.感谢!
有表table1,过程proc1
如何把table1中的field1,field2赋给proc1中的@a,@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