首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

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

2012-01-10 
关于存储过程中循环调用存储过程的问题.感谢!有表table1,过程proc1如何把table1中的field1,field2赋给proc

关于存储过程中循环调用存储过程的问题.感谢!
有表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

热点排行