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

游标不会循环是咋回事啊

2012-03-09 
游标不会循环是怎么回事啊?上次也碰到了这种问题不知道是怎么回事该检查哪里呢?[解决办法]while @@fetch_s

游标不会循环是怎么回事啊?
上次也碰到了这种问题
不知道是怎么回事
该检查哪里呢?

[解决办法]
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

热点排行