Skip to main content

Posts

Showing posts with the label SQL Query and Autonumber

Autonumber in select statement in SQL Server

Dear Friends You can identify the autonumber with SQL query through  ROW_NUMBER: Here is a query SELECT ROW_NUMBER() OVER (ORDER BY col1) AS rn, * FROM tbl1 To filter the results based on the row number use this: SELECT * FROM (     SELECT ROW_NUMBER() OVER (ORDER BY col1) AS rn, * FROM tbl1 ) T1 WHERE rn = 5 I hope it will help you Regards Rashid Imran Bilgrami http://www.bestvisualization.com