關於游標的定義
declare adm cursorfor select * from tableone order by cid
for update of name
open adm
declare @a int,@b int
set @a=1
select @b=count(*) from tableone
fetch next from adm
while @@fetch_status=0
begin
update tableone set name=@a where current of adm
set @a=@a+1
fetch next from adm
end
close adm
deallocate adm
上述定義了一個更新游標,但是。執行後,提示:
Server: Msg 16957, Level 16, State 4, Line 2
FOR UPDATE cannot be specified on a READ ONLY cursor.
請問是什麼原因呢??