SET COLLATION

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 18.3 and above

Sets the default collation for the session.

The default collation applies to all string operations for which there is no explicit collation or implicit collation. For details on how the default collation interacts with other collations, see Collation precedence.

Syntax

SET COLLATION collation_name

Parameters

  • collation_name

    The name of the collation. Common collations are:

    • UTF8_BINARY
    • UTF8_LCASE
    • UNICODE
    • UNICODE_CI

    For a complete list of supported collations, see Supported collations.

Examples

> SET COLLATION UNICODE_CI;

-- Use the default (session) collation because c1 has no collation set.
> SELECT * FROM VALUES('hello'), ('Hello') AS T(c1) ORDER BY c1;
 hello
 Hello