34,838
社区成员




declare mycursor CURSOR FOR .....
open cursor
fetch next from mycursor into .....
--这里不处理
while @@FETCH_STATUS = 0
begin
--这里处理,完再提取下一行
fetch next from mycursor into .....
end
close mycursor
deallocate mycursor
declare mycursor CURSOR FOR .....
open cursor
fetch next from mycursor into .....
while @@FETCH_STATUS = 0
begin
---从游标里面得到数据的处理过程
-- 处理已经fetch的结果
-- 处理结束后再次fetch
fetch next from mycursor into .....
end
close mycursor
deallocate mycursor