Skip to main content

[Migrated content. Thread originally posted on 28 July 2005]

With Acu4GL for SQL Server when doing a start greater than statement it creates SQL similar to the following :-

select KOP_CRNO, A4GLIdentity
from db.dbo.KOP
where ((KOP_SERVICE_CODE > "BCC ") or (KOP_SERVICE_CODE = "BCC " and KOP_CRNO >= 1001))
order by KOP_SERVICE_CODE asc, KOP_CRNO

which is fine, but when the table has hundreds of thousands of rows of which a large number will be returned by the query it can be very slow.

In our case we use paged grids so actually only require the first 25 or so of each query so what would be nice is if there was some way to specify the top nn records to be returned so the SQL could be generated as

select top 25 KOP_CRNO, A4GLIdentity
from db.dbo.KOP
where ((KOP_SERVICE_CODE > "BCC ") or (KOP_SERVICE_CODE = "BCC " and KOP_CRNO >= 1001))
order by KOP_SERVICE_CODE asc, KOP_CRNO

Adding something like a 4GL_TOP_COUNT along similar lines to the 4GL_WHERE_CONSTRAINT may be a way to do this.

[Migrated content. Thread originally posted on 28 July 2005]

With Acu4GL for SQL Server when doing a start greater than statement it creates SQL similar to the following :-

select KOP_CRNO, A4GLIdentity
from db.dbo.KOP
where ((KOP_SERVICE_CODE > "BCC ") or (KOP_SERVICE_CODE = "BCC " and KOP_CRNO >= 1001))
order by KOP_SERVICE_CODE asc, KOP_CRNO

which is fine, but when the table has hundreds of thousands of rows of which a large number will be returned by the query it can be very slow.

In our case we use paged grids so actually only require the first 25 or so of each query so what would be nice is if there was some way to specify the top nn records to be returned so the SQL could be generated as

select top 25 KOP_CRNO, A4GLIdentity
from db.dbo.KOP
where ((KOP_SERVICE_CODE > "BCC ") or (KOP_SERVICE_CODE = "BCC " and KOP_CRNO >= 1001))
order by KOP_SERVICE_CODE asc, KOP_CRNO

Adding something like a 4GL_TOP_COUNT along similar lines to the 4GL_WHERE_CONSTRAINT may be a way to do this.
Try using the A_MSSQL_ROWCOUNT environment variable.

[Migrated content. Thread originally posted on 28 July 2005]

With Acu4GL for SQL Server when doing a start greater than statement it creates SQL similar to the following :-

select KOP_CRNO, A4GLIdentity
from db.dbo.KOP
where ((KOP_SERVICE_CODE > "BCC ") or (KOP_SERVICE_CODE = "BCC " and KOP_CRNO >= 1001))
order by KOP_SERVICE_CODE asc, KOP_CRNO

which is fine, but when the table has hundreds of thousands of rows of which a large number will be returned by the query it can be very slow.

In our case we use paged grids so actually only require the first 25 or so of each query so what would be nice is if there was some way to specify the top nn records to be returned so the SQL could be generated as

select top 25 KOP_CRNO, A4GLIdentity
from db.dbo.KOP
where ((KOP_SERVICE_CODE > "BCC ") or (KOP_SERVICE_CODE = "BCC " and KOP_CRNO >= 1001))
order by KOP_SERVICE_CODE asc, KOP_CRNO

Adding something like a 4GL_TOP_COUNT along similar lines to the 4GL_WHERE_CONSTRAINT may be a way to do this.
Hmm.. I must read those Acu guides more carefully !!