当前位置: 代码迷 >> Sql Server >> 游标不会循环是咋回事啊
  详细解决方案

游标不会循环是咋回事啊

热度:23   发布时间:2016-04-27 19:03:50.0
游标不会循环是怎么回事啊?
上次也碰到了这种问题
不知道是怎么回事
该检查哪里呢?

------解决方案--------------------
while @@fetch_status
begin
fetch cursorname into @变量
end
------解决方案--------------------
fetch next @cursorname
------解决方案--------------------
用下面的格式,在while 之前要取一次
declare i cursor for xxxxxxxx
open i
declare @a varchar(50)
fetch next from i into @a
while (@@fetch_status=0)
begin
fetch next from i into @a
end
close i
deallocate i
  相关解决方案