Tuesday, March 27, 2012

Database Collation setting

I have a SQL Server 2005 database which is set for

SQL_Latin1_General_Cp1_CI_AS collation (Actually when the instance was created it was set to this collation).....I have lot og objects tables,views, fks, col constraints , triggers, default etc defined....

I need to change the collation of the database and subsequently affecting the collation of every single column to SQL_Latin1_General_Cp1_CS_AS

Now when I run the following command i gives me lot of errors saying that

ALTER DATABASE <dbName> COLLATE SQL_Latin1_General_Cp1_CS_AS

The column constranint <xx> is dependent on collation .....

The funny part is that this col constraint is defined on a float column instead of varchar column.....why is it giving error when it does not have any collation associated with it?

What are the steps that I need to take before running the alter collation on the database? (mean disabling fks constraints, col constraints etc,,,)

Any pointers will be greatly appreciated.

Regards

Imtiaz

It's not just straigt forward to change collation. My best experience is to (generate) script the old database and change the collation when creating a new one. After this you can import the tables into the new database with correct collation. If you use tempdb and don't want to use the collate clause - you need to rebuild the master database and all the system databases.

Hope this helps.

No comments:

Post a Comment