skip to main content
OpenEdge Data Management: DataServer for ODBC
Programming Considerations : Cursors : Forward and backward scrolling : Impact of MAX-ROWS
 
Impact of MAX-ROWS
The MAX-ROWS qualifier on a query determines the number of rows returned. The MAX-ROWS calculation is applied before any sorting is applied to the query, causing the results to be random. Consider the following example:
DEFINE QUERY qCustomer FOR customer SCROLLING.
OPEN QUERY qCustomer FOR EACH customer MAX-R0WS 15.
GET LAST qCustomer.
DISPLAY customer.custnum.
REPEAT:
GET PREV qCustomer.
DISPLAY customer.custnum.
END.
When this example is run with the OpenEdge sports database, the first record return has custnum 54, and the repeat loop displays other custnums in descending order from there. When this example is run with the sports database migrated to an ODBC data source, the first record returned has custnum 15, and the repeat loop displays values in descending order from there. This difference in results is a caused by the MAX-ROWS being applied prior to the sorting.