Groups | Blog | Home
all groups > sql server programming > april 2004 >

sql server programming : Paging Advice Needed


Martin Feuersteiner
4/17/2004 11:15:55 PM
Dear Group

A while ago I've asked how paging is possible and have read the articles on
aspfaq.com.

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

Martin Feuersteiner
4/18/2004 1:19:02 AM
Hi!
Just letting you know that I've found an answer to my problem at
http://weblogs.asp.net/pwilson/archive/2003/10/10/31456.aspx

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

Martin


[quoted text, click to view]

AddThis Social Bookmark Button