Set or Change Column Collation

http://msdn.microsoft.com/en-us/library/ms190920.aspx

 

You can override the database collation for char, varchar, text, nchar, nvarchar, and ntext data by specifying a different collation for a specific column of a table and using one of the following:

  • The COLLATE clause of CREATE TABLE and ALTER TABLE. For example:
    CREATE TABLE dbo.MyTable
      (PrimaryKey   int PRIMARY KEY,
       CharCol      varchar(10) COLLATE French_CI_AS NOT NULL
      );
    GO
    ALTER TABLE dbo.MyTable ALTER COLUMN CharCol
                varchar(10)COLLATE Latin1_General_CI_AS NOT NULL;
    GO

You cannot change the collation of a column that is currently referenced by any one of the following:

  • A computed column
  • An index
  • Distribution statistics, either generated automatically or by the CREATE STATISTICS statement
  • A CHECK constraint
  • A FOREIGN KEY constraint

When you work with tempdb, the COLLATE clause includes a database_default option to specify that a column in a temporary table uses the collation default of the current user database for the connection instead of the collation of tempdb.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.