Muokkaa

Jaa


Database collation support for dedicated SQL pool (formerly SQL DW) in Azure Synapse Analytics

You can change the default database collation from the Azure portal when you create a new dedicated SQL pool (formerly SQL DW). This capability makes it even easier to create a new database using one of the 3800 supported database collations.

This article applies to dedicated SQL pools (formerly SQL DW), for more information on dedicated SQL pools in Azure Synapse workspaces, see Collation types supported for Synapse SQL.

Collations provide the locale, code page, sort order, and character sensitivity rules for character-based data types. Once chosen, all columns and expressions requiring collation information inherit the chosen collation from the database setting. The default inheritance can be overridden by explicitly stating a different collation for a character-based data type.

Note

In Azure Synapse Analytics, query text (including variables, constants, etc.) is always handled using the database-level collation, and not the server-level collation as in other SQL Server offerings.

Check the current collation

To check the current collation for the database, you can run the following T-SQL snippet:

SELECT DATABASEPROPERTYEX(DB_NAME(), 'Collation') AS Collation;

When passed 'Collation' as the property parameter, the DatabasePropertyEx function returns the current collation for the database specified. For more information, see DATABASEPROPERTYEX.

Choose collation

To change the default collation, update the Collation field in the provisioning experience during the SQL pool creation. For example, if you want to change the default collation to be case-sensitive, modify the collation from SQL_Latin1_General_CP1_CI_AS to SQL_Latin1_General_CP1_CS_AS within the portal provisioning experience. Alternatively, you can modify the collation within your ARM template.

Note

Collation cannot be changed on an existing database. If you need to have a different collation at the SQL pool level, create a new SQL pool with the required collation.

Collation support

The following table shows which collation types are supported by which service.

Collation or collation type Serverless SQL pool Dedicated SQL pool - database & column Level Dedicated SQL pool - external table (native support) Dedicated SQL pool - external table (Hadoop/PolyBase)
Non-UTF-8 Collations Yes Yes Yes Yes
UTF-8 Yes Yes No No
Japanese_Bushu_Kakusu_140_* Yes Yes No No
Japanese_XJIS_140_* Yes Yes No No
SQL_EBCDIC1141_CP1_CS_AS No No No No
SQL_EBCDIC277_2_CP1_CS_AS No No No No

Additional information on best practices for dedicated SQL pool and serverless SQL pool can be found in the following articles: