游标不会循环是怎么回事啊?
上次也碰到了这种问题
不知道是怎么回事
该检查哪里呢?
[解决办法]
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