create table #t (seq int)
create clustered index t_seq on #t(seq)
go
insert #t values (1)
insert #t values (2)
insert #t values (3)
go
select * from #t

begin tran
declare @seq int
declare origseq insensitive cursor
for select seq from #t
open origseq
while ( 'FETCH IS OK' = 'FETCH IS OK' )
begin
        fetch origseq into @seq
        if @@fetch_status < 0  break

        update #t
        set seq = @seq + 10
        where seq = @seq
end
deallocate origseq
select * from #t
rollback
go
drop table #t
go
This page was last updated on May 01, 2006 04:28 PM.