Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Any function available for rowcount?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-08-08 : 08:40:57
Sarat writes "Hi,
I do like to know whether there is any function availble in SQLServer 2000 which gives me the number of the row. (Similar to 'rowid' in Oracle.)
To be a bit descriptive, consider the following data
tableName -> test

id name

1 john
2 baby
4 kepler
6 bunty

i need the results in the following way

id name count

1 john 1
2 baby 2
4 kepler 3
6 bunty 4

I tried to do it using a subquery like

select *,(select count(*) from test t1 where t1.id<=t2.id) count
from test t2

but it is taking a lot of processing time.
I will be thankful if you can suggest me any time saving method or any inbuilt function.
regards,
Sarat."
   

- Advertisement -