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 2005 Forums
 Transact-SQL (2005)
 How to track exact record at specific row number

Author  Topic 

rammohan
Posting Yak Master

212 Posts

Posted - 2008-02-20 : 10:32:18
here i need to get specific record at specific row number.
say if a table contains 10 records i need to get the record at 8th row. how it is possible in sql server2005 table?

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

jdaman
Constraint Violating Yak Guru

354 Posts

Posted - 2008-02-20 : 10:39:49
@n = row number you wish to have returned.
SELECT  *
FROM ( SELECT ROW_NUMBER() OVER(ORDER BY id_column) AS rn,
column1...
FROM YourTable
WHERE ...
) a
WHERE rn = @n
Go to Top of Page
   

- Advertisement -