• Subject: Converting SQLServer "select top..." statement to AS/400
  • From: "Walden H. Leverich" <WaldenL@xxxxxxxxxxxxxxx>
  • Date: Tue, 5 Dec 2000 14:06:09 -0500

All,

We are currently converting several SQLServer (7.0 and 2000) applications to
use the AS/400 as a database server. The front-end of these apps are and
will be .ASP files. Here is one problems we've hit so far. In SQLServer
there is the TOP option on a select statement. This allow a statement like:

select top 10 username, fullname, id from customer order by ytdsales

this statement would return a result set that contained only the top 10
customers ranked by year to date sales. When the program attempted to read
the 11th record it would receive an end of file condition. Simple, elegant,
nice! Now, there is no TOP operator on the AS/400. Suggestions?

1) Code to only read 10 rows and then quit
2) Code w/a subselect selecting by RRN in the superselect. 
3) Write results to temp file and select from there where RRN() <= 10
4) ?????

Please fill in #4.

Thanks,
-Walden

------------
Walden H Leverich III
President
Tech Software
(516)627-3800 x11
WaldenL@TechSoftInc.com
http://www.TechSoftInc.com
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.