日期:2014-05-17  浏览次数:20407 次

一个存储过程中的游标问题,在线急等
定义游标的时候随便我怎么定义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


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