Simulating ROWNUM in SQL Server 2000
This is one of the most frequent question asked in SQL
Server newsgroups. Basically how can we simulate the same behaviour as Oracle's
ROWNUM functionality. Here is one approach you can use to generate a pseudo row
number in SQL Server.
Select IDENTITY(int, 1,1) id, * INTO #Temp from authors
Select * from #Temp
Now you can observe that we have added a column id on
the fly to generate the temp table. This is a typical rownum generator in SQL
There are also MS KB articles with fetures to generate
row numbers. Visit
other methods of generating the same code.