Quantcast
Channel: How to select the nth row in a SQL database table? - Stack Overflow
Viewing all articles
Browse latest Browse all 35

Answer by Sangeeth Krishna for How to select the nth row in a SQL database table?

$
0
0

T-SQL - Selecting N'th RecordNumber from a Table

select * from (select row_number() over (order by Rand() desc) as Rno,* from TableName) T where T.Rno = RecordNumberWhere  RecordNumber --> Record Number to Select       TableName --> To be Replaced with your Table Name

For e.g. to select 5 th record from a table Employee, your query should be

select * from (select row_number() over (order by Rand() desc) as Rno,* from Employee) T where T.Rno = 5

Viewing all articles
Browse latest Browse all 35

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>