您的位置:首页 > 其它

利用游标修改、删除数据

2018-03-30 14:56 225 查看

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

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: