select @@VERSION as 版本

select @@LANGUAGE as 语言
go
select * from kc
 
declare yb insensitive cursor  --定义静态游标
for
select * from xs
open yb --打开游标
if @@ERROR=0        --判断游标是否打开成功0为成功,其失败
begin 
print '学生总数:'+convert(varchar(3),@@cursor_rows)   --@@cursor_rows 统计游标的行数
end
close yb --关闭游标
deallocate yb --释放游标
 
declare yb scroll cursor  --定义滚动游标
for
select * from xs
 
open yb --打开游标
fetch next from yb  --读取一行(向下)
fetch prior from yb --读取一行(向上)
fetch first from yb --读取第一行
fetch last from yb  --读取最后一行
fetch relative 1 from yb  --相对引用(当前的下一个)
fetch absolute 1 from yb  --绝对引用(游标的第一个)
close yb  --关闭游标
deallocate yb  --释放游标
 
fetch next from yb
while @@fetch_status=0
fetch next from yb
 
 
--修改当前记录
update kc
set 学分=4
where CURRENT OF yb
 
close yb
deallocate yb
 
--删除当前记录
delete from kc
where current of yb