Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - Database Administration » Database configuration » Database options » Alphabetical list of database options

sort_collation option

Allows implicit use of the SORTKEY function on ORDER BY expressions.

Allowed values

Internal, collation-name, or collation-id

Default

Internal

Scope
  PUBLIC role For current user For other users
Allowed to set permanently? Yes, with SET ANY PUBLIC OPTION Yes Yes, with SET ANY PUBLIC OPTION
Allowed to set temporarily? Yes, with SET ANY PUBLIC OPTION Yes (current connection only) No
Remarks

When the value of this option is Internal, the ORDER BY clause is treated as is.

When the value of this option is set to a valid collation name or collation ID, CHAR or NCHAR string expressions in the ORDER BY clause are treated as if the SORTKEY function had been invoked. String expressions that use other string data types, such as BINARY, UUID, XML, or VARBIT are not modified.

Example

Set the sort collation to binary:

SET TEMPORARY OPTION sort_collation='binary';

Having the sort collation set to binary transforms the following queries:

SELECT Name, ID
FROM Products
ORDER BY Name, ID;
SELECT name, ID
FROM Products
ORDER BY 1, 2;

The queries are transformed into:

SELECT Name, ID
FROM Products
ORDER BY SORTKEY(Name, 'binary'), ID;