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
 General SQL Server Forums
 New to SQL Server Programming
 row number of a table

Author  Topic 

asm
Posting Yak Master

140 Posts

Posted - 2007-04-09 : 02:09:02
Hi

Table name.. Emp
col- Name Salary
a 500
b 700
c 800
there must the the row no which is maintain by sql server.
So I want to retrive the row number of a given name.
How can i do this..

thanks

ASM

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-09 : 02:13:16
there is no such things as row number of a table. Records are not stored in any particular order in a table. The sequence of order of records retrieves is determine by the ORDER BY clause in your SELECT statement.

If you are using SQL Server 2005, you can use the ROW_NUMBER() function to show the row no but the it is still depending on the ORDER BY clause.


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-10 : 06:28:05
Also, why do you thin row number is important?
If you want to show data in front end, you can easily do numbering there

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -