SQL Server Architecture

Specifying Collations

Microsoft® SQL Server™ 2000 collations can be specified at several levels, including the following:

The collation of an identifier depends on the level at which it is defined. Identifiers of instance-level objects, such as logins and database names, are assigned the default collation of the instance. Identifiers of objects within a database, such as tables, views, and column names, are assigned the default collation of the database. Variables, GOTO labels, temporary stored procedures, and temporary tables can be created when the connection context is associated with one database, and then referenced when the context has been switched to another database. Because of this, the identifiers for variables, GOTO labels, and temporary tables are in the default collation of the instance.

Specifying collations for columns or literals can be done only for the char, varchar, text, nchar, nvarchar, and ntext data types.

Collations are generally identified by a collation name. There are two classes of names: Windows collation names for the new collations aligned with Windows locales, and SQL collation names for the compatibility mode collations that result when upgrading from earlier versions of SQL Server. For more information, see Windows Collation Name), and SQL Collation Name.

The exception to specifying collation names is in Setup:

You can execute the system function fn_helpcollations to retrieve a list of all the valid collation names for Windows collations and SQL collations, for example:

SELECT *
FROM ::fn_helpcollations()

You can also use the SQL-DMO ListCollations method to get a list of the valid collation names. For more information, see ListCollations Method.

The system catalog stored procedures have been enhanced to report the collation of all SQL Server objects that have a collation.

SQL Server can support only code pages that are supported by the underlying operating system. When you perform an action that depends on collations, the SQL Server collation used by the referenced object must use a code page supported by the operating system running on the computer. These actions can include:

If the collation specified or the collation used by the referenced object, uses a code page not supported by the Microsoft Windows® operating systems, SQL Server issues error 2775:

"Code page codepagenumber is not supported by the system."

Your response to this message depends on the version of the Windows operating system installed on the computer:

See Also

ALTER TABLE

Collation Options for International Support

Collations

Constants

CREATE DATABASE

CREATE TABLE

DECLARE @local_variable

table

Using Unicode Data