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.
Dig Deeper on Microsoft SQL Server Performance Monitoring and Tuning
Adding non-clustered indexes to SQL Server columns and tables frequently queried is possible. Learn how to add non-clustered indexes to SQL Server ...continue reading
Learn how to view a query execution plan in SQL Server with SQL Server Management Studio or Query Analyzer. Review and decrease query plan sub tree ...continue reading
Want to change the collation to SQL Server 2005 standards after upgrading databases from SQL Server 2000? Learn the best approach involving DTS and ...continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.