Friday, March 9, 2012

Question about Database Collations

I sent a couple of detached databases to a customer. When he installed his SQL Server he got database collation value of Latin1_General_CI_AS however, when he attached my databases they have a collation value of SQL_Latin1_General_CPI_CI_AS.

Now my stored procedures that use temp files are failing and a message is coming out SQL Server "Cannot resolve collation conflict for equal to operation"

I am assuming that the temp database has one collation value and my databases has another.

Q. Can anyone tell me the difference between the two collations? He is in Australia, I am in Canada - would he get a different default than I do?

Q. Can I safely alter the collation sequence of either the databases I sent or the temp database so that they match?

I have never run across this before but this is the first time I shipped the database offshore.

Thanks for any help you can give me. I am going to have to send my database to the Caribbean pretty soon and I need to know if this is going to happen there as well.

Well now that I've solved the problem I wonder what is the reasoning behind the defaults chosen by install.

First I can find no provision in the SQL Install to change the Default collation value.

My customer in Australia installed SQL Server on a new installation of Windows Server 2003 and got Latin1_General_CI_AS.
I built a brand new instance of Windows Server 2003 and when I installed SQL I got SQL_Latin1_General_CP1_CI_AS

The problem with my databases was in the stored procedures that used temporary tables - the collation values were different in the two databases and any comparisons on character fields failed.

I can work around the problem by altering all the stored procedures to include the collation clause to override the collation of tempdb. Is this the best way? I'm not sure. Is it a good practice to always include the collation clause when defining a table? I've always looked at it as kind of an annoyance -- never again Sad
|||

I am replying to this fairly old post because others may be wondering why they get the SQL_Latin1_General_CP1_CI_AS collation.

I believe that this is the 'old fashioned' collation used by versions of SQL Server prior to 2000. It seems to be offered on upgrade, whereas Latin1_General_CI_AS is used in from scratch installations. Certainly the latter is preferred.

I'm disappointed that SQL2005 doesn't have a change collation wizard and you need to create a DMO script in order to change the collation of existing databases.

|||

did you know which were the installation parameters you choose to get SQL_Latin1_General_CP1_CI_AS?

thanks for your help

|||

Andres,

Upon installation, you need to select "Collation designator and sort order:"
Set it to "Latin1_General"
then, check the box for "Accent - sensitive"

That should do it!

No comments:

Post a Comment