Friday, March 9, 2012

Paging Advice Needed

Dear Group

A while ago I've asked how paging is possible and have read the articles on
aspfaq.com. Great work, esp. the speed comparison of all the different
techniques. Thank you to everyone who has responded to my post. Somewhow
Google didn't let me reply to the thread!

All of the methods described work perfectly fine until I'm trying to
implement a WHERE or ORDER BY DESC on a particular field. E.g. Create all
pages but sort on a date field DESC doesn't start with the lowest date on
the first page and the highest date on the last page but all dates mixed up.

As a workaround I'm at first using a cursor to populate a temporary table
e.g. SELECT * FROM MyTable WHERE MyField1 = Condition ORDER BY MyField2
which only contains the data I would like to use to create the pages. I'm
using a cursor since I read that a normal SELECT to poulate the temporary
table doesn't always guarantee that rows are inserted in the correct order.

Next I'm creating the individual pages with the Count and Page.Rank method
off the temporary table.

This method is not the best in performance and I'm sure there must be
another
way to perform paging with filtering and sorting. I'm grateful for any tipps
you have.

Thanks for your time & efforts!

MartinHi!
Just letting you know that I've found an answer to my problem at
http://weblogs.asp.net/pwilson/arch...0/10/31456.aspx

titled 'Sorting and Paging in SQL Server' (including Filtering).
It's easy to use and pretty fast!

Martin

"Martin Feuersteiner" <theintrepidfox@.hotmail.com> wrote in message
news:c5rqu3$efu$1@.titan.btinternet.com...
> Dear Group
> A while ago I've asked how paging is possible and have read the articles
on
> aspfaq.com. Great work, esp. the speed comparison of all the different
> techniques. Thank you to everyone who has responded to my post. Somewhow
> Google didn't let me reply to the thread!
> All of the methods described work perfectly fine until I'm trying to
> implement a WHERE or ORDER BY DESC on a particular field. E.g. Create all
> pages but sort on a date field DESC doesn't start with the lowest date on
> the first page and the highest date on the last page but all dates mixed
up.
> As a workaround I'm at first using a cursor to populate a temporary table
> e.g. SELECT * FROM MyTable WHERE MyField1 = Condition ORDER BY MyField2
> which only contains the data I would like to use to create the pages. I'm
> using a cursor since I read that a normal SELECT to poulate the temporary
> table doesn't always guarantee that rows are inserted in the correct
order.
> Next I'm creating the individual pages with the Count and Page.Rank method
> off the temporary table.
> This method is not the best in performance and I'm sure there must be
> another
> way to perform paging with filtering and sorting. I'm grateful for any
tipps
> you have.
> Thanks for your time & efforts!
> Martin

No comments:

Post a Comment