Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How could I change the SQL Server 2008 R2 Express Default Collation for the whole server and a particular database?

Is there a way to do it using visual interface of SQL Server Management Studio? In the Server Properties window (and in the corresponding Database Properties window), this property is not available for editing.

share|improve this question
If you want to change the collation of all columns in the database look at this script. I've not tried it myself, but I did find it for a coworker that was looking to do just that. – Justin Dearing May 20 '11 at 18:51
If you want to change the collation of a database, check out this tool: It works with SQL Server 2005 and 2008 and it has worked better for me than the scripts you may find on the web. – Erwin May 31 '11 at 8:12
up vote 21 down vote accepted


You can change the default collation of SQL Server 2008 R2 express instance and individual databases, but it is a complex task.

Sadly, there is no visual option to do it via SSMS.

SQL Server 2008 supports setting collations at the following levels:

  • Server

  • Database

  • Column

  • Expression

The default installation settings are determined by the Windows system locale. The server-level collation can either be changed during setup, or by changing the Windows system locale before installation. more...

Setting and Changing the Server Collation - SQL Server 2008

  • Make sure you have all the information or scripts needed to re-create your user databases and all the objects in them.

  • Export all your data using a tool such as the bcp Utility. For more information, see Importing and Exporting Bulk Data.

  • Drop all the user databases.

  • Rebuild the master database specifying the new collation in the SQLCOLLATION property of the setup command

  • Create all the databases and all the objects in them.

  • Import all your data.

Setting and Changing the Database Collation - SQL Server 2008

  • Set the COLLATION option in the CREATE DATABASE statement while creating a new database.
  • Similarly, set the COLLATION options in the ALTER DATABASE statement to change the collation of an existing database.

    ALTER DATABASE [database_name] COLLATE SQL_Latin1_General_CP1_CI_AS;

Setting and Changing the Column Collation

  • Some of the column collations will remain the same even after you alter the database collation. In that case, you have to modify the collation of the individual columns.
share|improve this answer

Be sure you really want to "drop" the user databases as noted in the answer above. You may just want to "detach" the databases. Or really, you can do nothing as rebuilding the master effectively removes any links to the user databases. There are times when the databases are created in the desired collation but the server isn't. You wouldn't want to have to recover all your user databases from backups in this case.

share|improve this answer

I did something like this and it worked but you have to keep in mind the indexes that are pointing to data type as text/varchar/nvarchar have to be dropped, run the script and then create the indexes.

USE YourDataBase

SET @Table_Name = NULL--- THIS IS THE TableName that you want to change its collation columns

--- if null will set to all tables

,TableName NVARCHAR(100)
,ColumnName NVARCHAR(100)
,TypeName NVARCHAR(100)
,Max_length INT
,Collation_Name NVARCHAR(100)
DECLARE @NewCollation NVARCHAR(100)

INSERT INTO @TempTable(TableName,ColumnName,TypeName,Max_length,Collation_Name)
QUOTENAME(SCHEMA_NAME(tables.schema_id)) + '.' + QUOTENAME( AS TableName
, AS ColumnName
from sys.all_columns INNER JOIN sys.tables ON
tables.object_id = all_columns.object_id
AND collation_name IS NOT NULL
AND all_columns.collation_name != @NewCollation
WHERE tables.object_id = ISNULL(object_id(@Table_Name),all_columns.object_id)

SET @TableID = (SELECT MIN(ID) FROM @TempTable)

DECLARE @Query NVARCHAR(1000),@TableName NVARCHAR(100),@ColumnName NVARCHAR(100),@TypeName NVARCHAR(100)
,@Size INT

    SET @TableName = (SELECT TableName FROM @TempTable WHERE ID = @TableID)
    SET @ColumnName = (SELECT QUOTENAME(ColumnName) FROM @TempTable WHERE ID = @TableID)
    SET @TypeName = (SELECT TypeName FROM @TempTable WHERE ID = @TableID)
    SET @Size = (SELECT Max_length FROM @TempTable WHERE ID = @TableID) 

    SET @Query='ALTER TABLE ' + @TableName + ' ALTER COLUMN ' + @ColumnName + ' ' + @TypeName+ ISNULL ('(' +CAST(@Size AS VARCHAR(200))+')', '') +' COLLATE '+ @NewCollation  
    PRINT (@Query)

    SET @TableID = (SELECT MIN(ID) FROM @TempTable WHERE ID > @TableID)

this is my first answer posted pardon my mess

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.