当前位置: 代码迷 >> Sql Server >> 一个存储过程中的游标有关问题,在线急等
  详细解决方案

一个存储过程中的游标有关问题,在线急等

热度:88   发布时间:2016-04-25 01:12:59.0
一个存储过程中的游标问题,在线急等
定义游标的时候随便我怎么定义scroll 或keyset 或DYNAMIC 或 for update或多种参数组合设置当update的时候都是提示游标是只读的,无法更新,这是怎么回事?游标定义执行结果正常,就是不能update,在线急等
SQL code
declare enumcursor cursor scroll     for select * from t_enum where ID in (select * from lot.dbo.rlotclum()) order by id      for update     open enumcursor     fetch next from enumcursor     while @@fetch_status = 0     begin       update lot.dbo.t_enum set [ball] = 2 where CURRENT of enumcursor       fetch next from enumcursor    end             close enumcursor     deallocate enumcursor     select * from dbo.t_enum


------解决方案--------------------
动态游标,这个表上必须有主键才可以。
  相关解决方案