新手的问题

[复制链接]
查看11 | 回复0 | 2005-4-13 10:30:00 | 显示全部楼层 |阅读模式
我正制作一个运动会的系统
declare scursor cursor local scroll for

select id,classno,cno,studentname,sex

from 报名表
where items>0 and classno<200
open scursor
set @idtemp=0
while @@fetch_status=0
begin
fetch next
from scursor
into@id,@classno,@cno,@name,@sex

insert into 高一参赛 (id,classno,cno,name,sex)values

(@id,@classno,@cno,@name,@sex)
end
close scursor
deallocate scursor
我用了游标,可是每次插入完记录后,都发现游标集的最后一条记录在新表中被插入了两次,不知何故?谢谢指教。
我刚开始学,新手
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行