Re: Selecting Rows in groups
From: Adam Machanic (amachanic_at_hotmail._removetoemail_.com)
Date: 12/01/04
- Next message: Rich: "A Little Help Please With non visible tables"
- Previous message: Alejandro Mesa: "RE: Selecting Rows in groups"
- In reply to: Shallotx: "Selecting Rows in groups"
- Next in thread: Max: "Re: Selecting Rows in groups"
- Reply: Max: "Re: Selecting Rows in groups"
- Reply: Max: "Re: Selecting Rows in groups"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 1 Dec 2004 10:04:23 -0500
There are many ways to support paging from T-SQL, but no good ways.
However, in web applications there is generally not much choice. Since
you're not coding a web app, however, I think you have some additional
options available to you that will work better than a pure T-SQL solution.
Are your complete data sets small enough to cache on the client (all paging
in that case would be UI-based)? If that's more data than you feel
comfortable putting in memory, another option I've seen used to good effect
is caching primary keys from the initial request and sending back the next
10 keys each time to retrieve the actual data. This is generally more
efficient than re-sorting/filtering the actual data to only return 10 rows.
If you do want a T-SQL solution, though:
http://www.aspfaq.com/show.asp?id=2120
-- Adam Machanic SQL Server MVP http://www.sqljunkies.com/weblog/amachanic -- "Shallotx" <Shallotx@discussions.microsoft.com> wrote in message news:84A859C1-EEF7-498F-BF13-D5BFFD302073@microsoft.com... > I have seen a mumber of posts on this subject, but am still unsure as how to > implement. > > In my Windows Forms application, I am dynamically building a query based on > criteria the user chooses. In the event that the query will return a larger > number of rows (say 100 for discussion purposes), I want to return the rows > in groups (say 10 for discussion purposes). I will then allow the user to > return subsequent groups of 10 records if they desire. > > I understand I could write SELECT TOP 10 * FROM TABLE to return records > 1-10, but how do I then retreive 11-20, 21-30 etc. In the old days I know I > could use Cursors, but I believe there are better ways. > > Thank you
- Next message: Rich: "A Little Help Please With non visible tables"
- Previous message: Alejandro Mesa: "RE: Selecting Rows in groups"
- In reply to: Shallotx: "Selecting Rows in groups"
- Next in thread: Max: "Re: Selecting Rows in groups"
- Reply: Max: "Re: Selecting Rows in groups"
- Reply: Max: "Re: Selecting Rows in groups"
- Messages sorted by: [ date ] [ thread ]