-------------------------------------- Pitfalls of cursors script 4 -------------------------------------- create table #tempTable (pk int not null identity, charcol char(10)) GO insert into #tempTable (charcol) values('test1') insert into #tempTable (charcol) values('test2') insert into #tempTable (charcol) values('test3') insert into #tempTable (charcol) values('test4') insert into #tempTable (charcol) values('test5') declare UpdateTest cursor keyset for select * from #tempTable open UpdateTest fetch UpdateTest update #tempTable set charcol='test6' where current of updatetest --fails with the message --Server: Msg 16929, Level 16, State 1, Line 1 --The cursor is READ ONLY. --The statement has been terminated. select * from #tempTable close UpdateTest deallocate UpdateTest drop table #tempTable GO create table #tempTable (pk int not null identity primary key,--not the primary key index charcol char(10)) GO insert into #tempTable (charcol) values('test1') insert into #tempTable (charcol) values('test2') insert into #tempTable (charcol) values('test3') insert into #tempTable (charcol) values('test4') insert into #tempTable (charcol) values('test5') declare UpdateTest cursor keyset for select * from #tempTable open UpdateTest fetch UpdateTest update #tempTable set charcol='test6' where current of updatetest --works this time select * from #tempTable close UpdateTest deallocate UpdateTest drop table #tempTable --------------------------------------