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
 Transact-SQL (2000)
 Nth row of a table

Author  Topic 

Shastryv
Posting Yak Master

145 Posts

Posted - 2002-05-03 : 16:59:48
Is any body know how to find the Nth row of a Table. N may be any +ve value

Thanks

Shastry.V

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-05-03 : 17:08:55
graz's article should do the trick:

http://www.sqlteam.com/item.asp?ItemID=566

You can modify it pretty easily to retrieve a single row at position N.

Don't forget that the concept of row position doesn't exist in a relational database system. Rows are identified by the data they hold, not their relative position to other rows. Row number is meaningless without an ORDER BY clause; if you are not using ORDER BY in your SELECT statement you will NOT get consistent results.

Go to Top of Page

Shastryv
Posting Yak Master

145 Posts

Posted - 2002-05-03 : 17:16:40
I don't want top 10 or 20 records. I just want only one record. Like 4th row from a table or 5th in general Nth row

Shastry.V
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-05-03 : 17:29:02
quote:
You can modify it pretty easily to retrieve a single row at position N.


Go to Top of Page

Shastryv
Posting Yak Master

145 Posts

Posted - 2002-05-03 : 17:41:19
May be it's easy for you. I am very poor in T-SQL.

Shastry.V
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-05-03 : 17:44:54
And you won't get any better at it if you don't try.

I don't mean to sound like an asshole, but it is completely unreasonable for you to expect someone to do all the work for you. You can modify it by changing 2 numbers and it will do exactly what you want. And not only that, you will gain a deeper understanding of SQL Server by doing so, which would NOT happen if someone else did the work for you.



Go to Top of Page
   

- Advertisement -