Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
In search of: an equivalent to Oracle's RowNum
Message
From
20/10/2000 10:32:35
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00424318
Message ID:
00432071
Views:
23
Very interesting. Frustrating, but interesting. :)

Thanks, Larry, that helps.

>You have to make the decision where you are going to make your limits. The search engines I looked at (Altavist and Google) don't give you acces to all the sites they find. For example, I did a search on Microsoft. Altavista found over 9 million web pages with that word but it limits you to the first 200. You can configure the number of results per page but the end result is still limited to 200. Google is a better in that it allows you to configure up to 100 entries per page and its limit of 10 result pages doe snot change so you can get back up to 1000 results (you are normally limited to 100).
>
>So you can use an ADO record set or use a temporary cursor and FETCH approach to this.
>
>>Well, I've thought of that, but here's what I find:
>>
>>Let's say a user issues a query that results in 1000 records found, and they've chosen for only 50 to display at a time in an HTML table in their browser. Now, let's further postulate that the presentation of the data is in date order, rather than in index key ID. The initial query would be simple:
>>
>>SELECT TOP 50 [whatever] FROM MyTable WHERE [something] ORDER BY [Date]
>>
>>That way you don't have all the records taking up space on the server in a cursor or ADO. Using TOP or SET ROWCOUNT would have the same effect.
>>
>>Now, moving to records 51-100 would be easy enough: Grab the next set of records that have a date greater than the last date known (via the variable technique you describe) in the first set:
>>
>>SELECT TOP 50 [whatever] FROM MyTable WHERE [something] AND [date > @variable] ORDER BY [Date]
>>
>>Works fine. Now, since they actually have 20 pages from which to choose (1000 records at 50 per page), they choose to jump to page 7. Quick: how do we know what the filtering criteria (date > @variable) should be? We don't know the last date of page 6, nor can we be sure that the date wouldn't be present on page 7. Even if we could narrow the criteria with other variables (unique IDs of some kind), the same "what came on the page before me" issue would persist.
>>
>>This is why I'm desperately looking for a way to do something like:
>>
>>SELECT [whatever] FROM MyTable WHERE [something] ORDER BY [Date] HAVING RowCount > 351 and RowCount < 401
>>
>>Problem is, there's no RowCount, or even the equivalent I can find. How on earth do they handle this with, say, AltaVista or Excite, where a query returns 114,774 web page references found? I can't imagine they build such an enormous ADO for each user session!
>>
>>Am I just looking at this all wrong? Is this something I should be scanning with Transact SQL instead? Grrrr... :)
>>
>*snip*
Scott D. Grabo
Chief Information Officer
Occupational Health Group
First Advantage Corporation
Previous
Reply
Map
View

Click here to load this message in the networking platform