CodeCharge Studio

Use LIMIT/TOP Property

Specify if the LIMIT or TOP clause should be used to limit the size of SQL result sets.

Applies to

Connection

Description

Use this property to optimize the database performance by returning only the records that are used within the form. If set to "Yes", the changes will be applied to the Data Source of the Grid, Editable Grid and Record components when used with any of the following databases: MySQL, PostgreSQL, Microsoft SQL Server and Microsoft Access.

The following table shows how the "Use LIMIT/TOP" property is utilized:
Component Database Description
Grid, Editable Grid MySQL When using Table or SQL data source, "LIMIT offset, row_count" is applied to the Select SQL at the end of the SQL statement.
PgSQL When using Table or SQL data source, "LIMIT row_count OFFSET offset" is applied to the Select SQL at the end of the SQL statement.
MS SQL Server, MS Access When using Table data source, "TOP row_count+offset" is applied automatically.

When using SQL data source and the SQL begins with SELECT, "TOP row_count+offset" is applied after "SELECT" or "SELECT DISTINCT" or "SELECT ALL".

However, "TOP" is not applied to the SQL data source if SQL already contains TOP or "UNION [ALL] SELECT" in the SQL body.

Record MySQL, PgSQL LIMIT 1 is added to the Select SQL after ORDER BY.
MS SQL Server, MS Access When using Table or SQL data source, "TOP 1" is applied to the Select SQL in the same manner as when using the Grid component.

Notes:

See Also

Connection Reference, Connecting to Databases


On-line, printable versions and updates