declare @id int
declare @xuehaos char(20)
declare @xuehao char(20)
set @xuehao=1
declare @dianhuas char(20)
declare youbiao1 cursor for
select id,xuehao,dianhua from xuesheng
open youbiao1
fetch next from xuesheng
into @id,@xuehaos,@dianhuas
while @@fetch_status=0
begin
if @xuehao=@xuehaos
delete from xuesheng where @xuehao=@xuehaos
fetch next from youbiao1
into @id,@xuehaos,@dianhuas
end
close youbiao1
deallocate youbiao1
执行提示:
消息 16916,级别 16,状态 1,第 8 行
名为 'xuesheng' 的游标不存在。
|