How to Display information which spans across multiple pages

Assume that you need to display 50 records in a webpage. The database has 1000 records consisting all the employees across the globe. In the above scenario, it really makes sense to retrieve only the required records.
For example, in the first page, retrieve 1 to 50 records. When the user clicks on “next” button, retrieve records 51 to 100 and so on.
Example :
SELECT * FROM
(
SELECT ROW_NUMBER() OVER (ORDER BY EmpId) AS Sno, * FROM Employee
) AS a WHERE Sno BETWEEN 51 AND 100
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s