Q
Problem solve Get help with specific problems with your technologies, process and projects.

What's the best way to page SQL Server data results?

My question is regarding paging SQL Server data results. I am using PHP with SQL Server. For a specific search I have nearly 500 records. I am displaying 50 results per page and providing PREV and NEXT option for paging. In order to fetch the second set of results (for page 2), what I am doing is running the query again (fetching the whole 500 records) and just filtering the first 50 records inside the script and start displaying records from 50 to 100. I know this is not the best way to do it. Could you please suggest a better solution for this? Also, is it Ok to query the database for each page? At the same time, my query involves joins with 3 tables. Please help me on this.
I am not familiar with PHP but look into the record set options. I know with the latest build of ADO.NET, many options are available to cache the record set and only traverse the record sets that are needed and then query SQL Server for the needed data.
This was last published in December 2005

Dig Deeper on Microsoft SQL Server Performance Monitoring and Tuning

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close