Here is a logic that you can try..
[tt]
declare @num as int
declare @exists int
declare @au_id as char(15)
DROP TABLE #TBL_temp
declare cur_count cursor for
select au_id from authors
SELECT @NUM=0
SELECT @num AS NUM, au_id, au_lname, au_fname, phone, address, city, state, zip, contract into #TBL_temp from authors
DELETE #TBL_temp
open cur_count
readnext:
fetch next from cur_count into
@au_id
If @@FETCH_STATUS <> 0
goto eof
If @au_id<>''
Begin
select @num=@num+1
Print @num
Print @au_id
Insert into #TBL_temp
SELECT @num AS NUM, au_id, au_lname, au_fname, phone, address, city, state, zip, contract from authors where au_id=@au_id
end
goto readnext
eof:
close cur_count
deallocate cur_count
SELECT * FROM #TBL_temp
--DROP TABLE #TBL_temp
[/tt]
Dr.Sql
Good Luck.