Posted by David Portas on 09/28/10 11:35
wackyphill@yahoo.com wrote:
> If you were doing paging of results on a web page and were interested
> in grabbing say records 10-20 of a result set. But also wanted to know
> the total # of records in the result set (so you could know the total #
> of pages in the set).
>
> Would it be better to query the DB table 2X. Once for Count(*). And
> again for the records for the current page?
>
> Or better to create a temp table, select the records into it, and then
> get count(*) and the page results from the temp table?
>
> I saw an example in a book that made a temp table to do this and to me
> it seemed like it would be slower. I don't get the reason for a temp
> table. Anyone have any ideas?
Take a look here:
http://www.aspfaq.com/show.asp?id=2120
--
David Portas
SQL Server MVP
--
[Back to original message]
|