Introduction: In previous article i explained How to select records between specified range in SQL Server? and How to convert/downgrade SQL Server 2012,2008 database to SQL Server 2005 or lower version and Get column values as comma separated list in sql server | Convert column values to row
Now in this article i will explain How to get/retrieve specific range of rows from SQL Server database table ?.Suppose there are 100 rows in your table and you want to retrieve only specified rows e.g. 10th to 20th. You can do this by using ROW_NUMBER () function provided by Sql server.
Now in this article i will explain How to get/retrieve specific range of rows from SQL Server database table ?.Suppose there are 100 rows in your table and you want to retrieve only specified rows e.g. 10th to 20th. You can do this by using ROW_NUMBER () function provided by Sql server.
Here is the query
SELECT * FROM ( SELECT *, ROW_NUMBER() OVER (ORDER BY EmpId) AS row FROM MyTable) temp
Note: Replace the “EmpId” with your column name(primary
key column) and “MyTable” with
your table name. It will retrieve the records
from rows 10 to 20 from your table.
Now over to you:
"If you like my work; you can appreciate by leaving your comments,
hitting Facebook like button, following on Google+, Twitter, Linked in and
Pinterest, stumbling my posts on stumble upon and subscribing for receiving
free updates directly to your inbox . Stay tuned and stay connected for more
technical updates."
Similar useful articles
Ø How to delete all tables from Sql server Database
Ø Take automatic backup of Sql server Database
Ø Copy all data from one table to another in the same database in Sql Server
Ø Copy all data from one database table to another database table in Sql Server
Ø How to concatenate two strings in Sql Server
Ø How to take Sql server database backup
Ø How to delete all tables from Sql server Database
Ø Take automatic backup of Sql server Database
Ø Copy all data from one table to another in the same database in Sql Server
Ø Copy all data from one database table to another database table in Sql Server
Ø How to concatenate two strings in Sql Server
Ø How to take Sql server database backup
If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..