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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-01-05 : 08:09:25
|
| Vijay writes "I have a table containing large number of rows ( more than 75,000). I need to get these objects out based on some criteria. But I can't get them all at a time due to perf issues. I need to send 1000 objects at a time. So I will execute a query/Stored Proc etc as many times until there is no more objects to return. Question is - Is there is a standard pattern/way to solve this problem where results need to be returned in chunks but SQL script have to return from where it stopped last time. ( Note that no state information should be held inside the SQL server DB)The client is willing to pass any hint to the script so that it knows from where to begin the next set of rows to return.For eg. Let's say I have a table A, which has OID as a column, parent_oid as another column ( FK with the parent) and some string columns.The first time the script return 1000 objects, can it also send back the 1000th OID back to the client so that the client passes this the second time it calls and the script can make use of this. ( But the problem is that script(SP) has to sort (Descending)on the OID, then return Top 1 so that OID is returned to the client. This may be a perf issue)Note that I don;t care about inconsistency ( some objects getting inserted/deleted while something is going on).If anybody has come across such problems and found a solution - Pl let me know Thanks in advanceVijay" |
|
|
|
|
|