码迷,mamicode.com
首页 > 其他好文 > 详细

利用游标修改、删除数据

时间:2018-03-30 15:14:11      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:int   nbsp   stat   删除   bsp   from   标识   select   absolute   

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

利用游标修改、删除数据

标签:int   nbsp   stat   删除   bsp   from   标识   select   absolute   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!