排序规则和 CLR 集成数据类型Collation and CLR Integration Data Types

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions)

在中 .NET Framework.NET FrameworkCompareInfo对象处理排序规则。In the .NET Framework.NET Framework, the CompareInfo object handles collations. .NET Framework.NET Framework字符串应用程序编程接口(api)使用与当前线程的CultureInfo对象关联的CompareInfo属性来执行字符串比较。The .NET Framework.NET Framework string application programming interfaces (APIs) use the CompareInfo property associated with the CultureInfo object of the current thread to perform string comparisons. CultureInfo对象的默认设置基于 MicrosoftMicrosoft 运行的计算机的 Windows 区域设置 MicrosoftMicrosoft SQL ServerSQL ServerThe default setting of the CultureInfo object is based on the MicrosoftMicrosoft Windows locale setting for the computer on which MicrosoftMicrosoft SQL ServerSQL Server is running. 这会确定默认的比较语义(如果没有指定显式CultureInfo )来比较system.string值。This determines the default comparison semantics, if no explicit CultureInfo is specified, for comparisons of System.String values. SQL ServerSQL Server不会将CompareInfo属性显式更改为数据库或服务器排序规则。does not explicitly change the CompareInfo property to the database or server collation. 如果需要,用户必须在其例程中设置相应的CompareInfo属性。If required, users must set the appropriate CompareInfo property in their routines.

参数排序规则Parameter Collation

当你创建公共语言运行时(CLR)例程,并且绑定到例程的 CLR 方法的参数为SQLString类型时,将 SQL ServerSQL Server 使用包含调用例程的数据库的默认排序规则创建参数的实例。When you create a common language runtime (CLR) routine, and a parameter of a CLR method bound to the routine is of type SQLString, SQL ServerSQL Server creates an instance of the parameter with the default collation of the database containing the calling routine. 如果参数不是SqlType (例如, String而不是SQLString),则数据库中的排序规则信息不与参数相关联。If a parameter is not a SqlType (for example, String rather than SQLString), the collation information from the database is not associated with the parameter.

另请参阅See Also

.NET Framework 中的 SQL Server 数据类型SQL Server Data Types in the .NET Framework