create procedure testc
AsDECLARE authors_cursor CURSOR FOR
SELECT * FROM testcur oRDER BY idOPEN authors_cursor-- Perform the first fetch.
FETCH NEXT FROM authors_cursordeclare @i int
set @i=1
WHILE @@FETCH_STATUS = 0
BEGIN
update testcur set testid=@i where id=@i
set @i=@i+1
FETCH NEXT FROM authors_cursor
ENDCLOSE authors_cursor
DEALLOCATE authors_cursor
GO
AsDECLARE authors_cursor CURSOR FOR
SELECT * FROM testcur oRDER BY idOPEN authors_cursor-- Perform the first fetch.
FETCH NEXT FROM authors_cursordeclare @i int
set @i=1
WHILE @@FETCH_STATUS = 0
BEGIN
update testcur set testid=@i where id=@i
set @i=@i+1
FETCH NEXT FROM authors_cursor
ENDCLOSE authors_cursor
DEALLOCATE authors_cursor
GO
SELECT * FROM testcur oRDER BY idOPEN authors_cursor-- Perform the first fetch.
FETCH NEXT FROM authors_cursordeclare @i int
set @i=1
WHILE @@FETCH_STATUS = 0
BEGIN
update testcur set testid=@i
set @i=@i+1
FETCH NEXT FROM authors_cursor
ENDCLOSE authors_cursor
DEALLOCATE authors_cursor
GO