Collation and CLR Integration Data Types

Applies to: SQL Server

In the .NET Framework, the CompareInfo object handles collations. The .NET Framework string application programming interfaces (APIs) use the CompareInfo property associated with the CultureInfo object of the current thread to perform string comparisons. The default setting of the CultureInfo object is based on the Microsoft Windows locale setting for the computer on which Microsoft SQL Server is running. This determines the default comparison semantics, if no explicit CultureInfo is specified, for comparisons of System.String values. SQL Server does not explicitly change the CompareInfo property to the database or server collation. If required, users must set the appropriate CompareInfo property in their routines.

Parameter Collation

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 Server creates an instance of the parameter with the default collation of the database containing the calling routine. 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

SQL Server Data Types in the .NET Framework