利用游标修改、删除数据

时间:2018-03-30 15:02:19   收藏:0   阅读:212

declare auth_cur cursor scroll for

select au_id, au_lname, au_fname, state

from authors for update of au_lname

open auth_cur

declare @rowcount int

set @rowcount = 6

fetch absolute @rowcount from auth_cur  --将变量@rowcount标识的行设置为当前行

--下面1行是利用游标进行修改操作

update authors set au_lname=‘‘ where current of auth_cur --修改游标中的当前行

--下面1行是利用游标进行删除操作

delete from authors where current of auth_cur

原文:https://www.cnblogs.com/xiaowie/p/8676203.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!