Question

I'm trying to extract data from a Progress 9.1D09 database. I understand that this isn't the latest version of Progress but upgrading isn't an option. The database is used by a dying program and I am moving the data to its successor.

One table has 162000 rows. I want to work with a small number of rows.

In SQL Server I would change my query to "select top 100 * from ...". In MySQL I would do "select * from ... limit 0,100".

Neither of these syntaxes work and googling for the right syntax has failed me so far.

How can I limit the number of rows in the source data using SQL?

Was it helpful?

Solution

Rule #1 -- Progress is not SQL. Progress does support a SQL-92 interface and it also has SQL-89 syntax embedded -- but SQL is not the native tongue for a Progress DB.

If you are using the embedded SQL-89 there is no support for TOP. The embedded SQL is accessed via the 4GL engine. If you are not using ODBC or JDBC you are probably trying to use embedded SQL-89. If syntax like:

FOR EACH customer NO-LOCK:
  DISPLAY customer.
END.

works then you are using the 4GL and thus the embedded SQL-89.

A 4GL solution might look like this:

Getting first 100 records from the table in Progress OpenEdge database (e.g. SELECT TOP 100..)

If you are using SQL-92 via ODBC drivers -- TOP support was added sometime in 10.1B

http://knowledgebase.progress.com/articles/Article/P13258

So you're out of luck with v9.

OTHER TIPS

You can try rownumber something like

SELECT FirstName, LastName, ROW_NUMBER() 
  OVER (ORDER BY PostalCode) AS 'RowNumber' 
  WHERE RowNumber BETWEEN(4,100)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top