Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Bex
Aged Yak Warrior
580 Posts |
Posted - 2005-04-12 : 05:53:59
|
| I have been writing a sproc to return data based on optional parameters provided by the users.A colleague has asked whether there is a method to limit a result set to an application call (for example, return the first 30 record sets of 300 records that resulted from a query). The reason for doing so, is to prevent too many records crashing the application, and to allow users to page through the results.One method we thought 0f, was for the first call of the sproc, pass the application the last ID field value (of the 30 selected) to the application. On the second call, the application will pass back this value, and the sproc will select the next TOP 30 using the ID field value as a condition (WHERE CustomerID > @customerID). This will repeat until all record sets have been returned.However, a flaw with this method is that this assumes that the user will want to chronologically page through the result set. Can anyone offer any advice or any ideasas how to tackle this problem??Thanks in advanceHearty head pats |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
|
|
Bex
Aged Yak Warrior
580 Posts |
Posted - 2005-04-12 : 06:03:38
|
| Brilliant! Just what I wanted! Thanks Spirit for coming through again!!!Hearty head pats |
 |
|
|
|
|
|