basilhs_s
asked on
sql select statement counting the results
i am using sql server 2000. every time i am executing a select statement (f.e) select fielda, fieldb from table_a results come as follwing
a1 a2
b1 b2
c1 c2
d1 d2
.. ...
how can i create a column which will contains a increment by 1 counter. the select in this case should return
1 a1 a2
2 b1 b2
3 c1 c2
4 d1 d2
.......
........
.........
a1 a2
b1 b2
c1 c2
d1 d2
.. ...
how can i create a column which will contains a increment by 1 counter. the select in this case should return
1 a1 a2
2 b1 b2
3 c1 c2
4 d1 d2
.......
........
.........
ASKER
row_number is not supported in sql server 2000
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
perfect answer for two reason. i saw how we count rows in sql server 2000 and since we are qoing to upgrade to sql sever 2008 soon i learned how i can use the row_counter() function there.. thanks very much
http://msdn.microsoft.com/en-us/library/ms186734.aspx