Wednesday, March 7, 2012

pagination advice

Hi

I'm still quite new to MSSQL so excuse the trivial questions.
I've already tried searching through the forums on pagination as im sure its a big subject but couldn't find the answers i'm after.

I'm using MSSQL 2000 and asp .net 2.0 and basically need to paginate my results. My database contains roughly 250,000 rows of data, and one query would approximately return 30 results at the most. I would want to have 5 results per page.

I'm starting from scratch so was wondering what technique i could use. I can't use OFFSET as thats MySQL, is there an equivalent?
I've heard mixed opinions on Cursors, but so far thats the only way i can see at the moment! :S

thanksNo cursors, please.

Use a query that assigns an ordinal value to each record in the recordset (you will need a unique column or group of columns by which you can reliably order the results).

Then have your interface submit a request for a result set returning only rows N through M.

No comments:

Post a Comment