COLLATION

Van toepassing op:controleren gemarkeerd ja Databricks SQL-controle gemarkeerd als ja Databricks Runtime 18.3 en hoger

Met COLLATION de configuratieparameter wordt de standaardsortering voor de sessie ingesteld.

De standaardsortering is van toepassing op alle tekenreeksbewerkingen waarvoor geen expliciete sortering of impliciete sortering bestaat. Zie Standaardsortering voor de volledige derivatieregels en sorteringsprioriteit voor hoe expliciete en impliciete sorteringen de standaardinstelling overschrijven.

U kunt deze parameter instellen op sessieniveau met behulp van de SET COLLATION-instructie.

Configuratie

De parameter moet worden ingesteld op een collation_name.

Veelvoorkomende sorteringen zijn:

  • UTF8_BINARY
  • UTF8_LCASE
  • UNICODE
  • UNICODE_CI

Zie Ondersteunde sorteringen voor een volledige lijst met ondersteunde sorteringen.

Systeemstandaardwaarde

De standaardwaarde van het systeem is UTF8_BINARY.

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

-- The default collation also applies to string literals.
> SELECT 'a' = 'A';
 true

-- Reset the default collation back to the system default.
> SET COLLATION UTF8_BINARY;
> SELECT 'a' = 'A';
 false