User Tools

Site Tools


prop_sqlorder.htm
Navigation:  SQL Driver Properties(General) >====== PROP:SQLOrder ====== Previous pageReturn to chapter overviewNext page

You can use PROP:SQLOrder to sort your VIEWs using native SQL code rather than Clarion code.

NoteBox.jpg

Using PROP:SQLOrder may slow down performance in certain circumstances.

When you use PROP:SQLOrder, the SQL order is passed directly to the server. As such it cannot contain the name of tables, variables, or functions that the server is not aware of; that is the order expression must be valid SQL syntax with valid SQL column names. For example:

View{PROP:SQLOrder} = 'TO_DATE - FROM_DATE'

Note that the SQL Accelerator incorporates the PROP:SQLOrder expression into the ORDERBY clause of a generated SELECT statement. The generated SELECT statement may reference one or more tables by aliases. If your order expression also references tables (e.g., Customer.Name <; 'T'), you must use the same aliase names generated by the SQL Accelerator. By default, the SQL Accelerator uses the next letter of the alphabet as the alias name. For example, the Accelerator uses 'A' as the alias for the first table in the generated SELECT statement, then 'B' for the next table, and so on. You can use PROP:Alias to control the alias names generated by the SQL Accelerator. See PROP:Alias for more information.

Combining SQL Orders and VIEW Orders

When you use PROP:SQLOrder, the SQL order can either replace any order specified for the VIEW, or it may be in addition to the order specified for the VIEW. Prefix the SQL order with a plus sign (+) to append the SQL order to the existing VIEW order.

For example:

View{PROP:SQLOrder} = '+ TO_DATE - FROM_DATE'

When you append the SQL order by using the (+) plus sign, the result set is ordered first by the Clarion order expression, then by the SQL order expression.

Omit the plus sign (+) to replace the Clarion order with the SQL order.

See Also:     PROP:Order

prop_sqlorder.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1