SQL Server 排序规则名称 (Transact-SQL)SQL Server Collation Name (Transact-SQL)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance 是Azure Synapse AnalyticsAzure Synapse AnalyticsyesAzure Synapse AnalyticsAzure Synapse Analytics 是并行数据仓库Parallel Data Warehouseyes并行数据仓库Parallel Data Warehouse适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance 是Azure Synapse AnalyticsAzure Synapse AnalyticsyesAzure Synapse AnalyticsAzure Synapse Analytics 是并行数据仓库Parallel Data Warehouseyes并行数据仓库Parallel Data Warehouse

SQL ServerSQL Server 排序规则指定排序规则名称的单个字符串。Is a single string that specifies the collation name for a SQL ServerSQL Server collation.

SQL ServerSQL Server 支持 Windows 排序规则。supports Windows collations. SQL ServerSQL Server 还支持有限数量(小于 80 个)的排序规则(称为 SQL ServerSQL Server 排序规则),这些规则是在 SQL ServerSQL Server 支持的 Windows 排序规则之前开发的。also supports a limited number (<80) of collations called SQL ServerSQL Server collations which were developed before SQL ServerSQL Server supported Windows collations. 仍然支持 SQL ServerSQL Server 排序规则只是为了实现向后兼容性,不应将这些排序规则用于新开发工作。SQL ServerSQL Server collations are still supported for backward compatibility, but should not be used for new development work. 有关 Windows 排序规则的详细信息,请参阅 Windows 排序规则名称For more information about Windows collations, see Windows Collation Name.

主题链接图标 Transact-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

<SQL_collation_name> :: =
SQL_SortRules[_Pref]_CPCodepage_<ComparisonStyle>

<ComparisonStyle> ::=
_CaseSensitivity_AccentSensitivity | _BIN

备注

若要查看 SQL Server 2014 及更早版本的 Transact-SQL 语法,请参阅早期版本文档To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.

参数Arguments

SortRules 标识字母表或语言的字符串,当指定按字典排序时应用该字母表或语言的排序规则。SortRules A string identifying the alphabet or language whose sorting rules are applied when dictionary sorting is specified. 例如 Latin1_General 或波兰语。Examples are Latin1_General or Polish.

Pref 指定大写字母优先。Pref Specifies uppercase preference. 即使比较时不区分大小写,在没有其他区别的情况下,大写字母也将排在小写字母之前。Even if comparison is case-insensitive, the uppercase version of a letter sorts before the lowercase version, when there is no other distinction.

Codepage 指定用于标识排序规则所使用的代码页的 1 至 4 位数号码。Codepage Specifies a one- to four-digit number that identifies the code page used by the collation. CP1 指定代码页 1252,对于其他所有代码页,则需指定完整的代码页编号。CP1 specifies code page 1252, for all other code pages the complete code page number is specified. 例如,CP1251 指定代码页 1251,CP850 指定代码页 850。For example, CP1251 specifies code page 1251 and CP850 specifies code page 850.

CaseSensitivity CI 指定不区分大小写,CS 指定区分大小写。CaseSensitivity CI specifies case-insensitive, CS specifies case-sensitive.

AccentSensitivity AI 指定不区分重音,AS 指定区分重音。AccentSensitivity AI specifies accent-insensitive, AS specifies accent-sensitive.

BIN 指定使用二进制排序顺序。BIN Specifies the binary sort order to be used.

注解Remarks

若要列出您的服务器支持的 SQL ServerSQL Server 排序规则,请执行以下查询。To list the SQL ServerSQL Server collations supported by your server, execute the following query.

SELECT * FROM sys.fn_helpcollations()
WHERE name LIKE 'SQL%';

备注

对于排序顺序 ID 80,请使用代码页为 1250 的任何 Window 排序规则,并使用二进制顺序。For Sort Order ID 80, use any of the Window collations with the code page of 1250, and binary order. 例如:Albanian_BIN、Croatian_BIN、Czech_BIN、Romanian_BIN、Slovak_BIN、Slovenian_BIN。For example: Albanian_BIN, Croatian_BIN, Czech_BIN, Romanian_BIN, Slovak_BIN, Slovenian_BIN.

另请参阅See Also