steven
steven

Reputation:

SQL Server Collation Conflict

Transferring data from one SQL server to another but when Schema is compared and syncronised the following error is received. We are using redgate SQL compare to complete.

Cannot resolve collation conflict for equal to operation

Base SQL server is SQL_Latin1_General_CP1_CI_AS and the destination server is Latin1_General_CI_AS

Upvotes: 4

Views: 4607

Answers (5)

Wonko
Wonko

Reputation: 331

"Ignore collations" is definitely not going to work, for the reason stated above. The problem happens when migrating objects like views and stored procedures that use JOIN clauses on text fields that have differing collations.

If someone changes the default collation on the server and the column on the other side of the JOIN uses a specific collation, you've caused this issue. And it would happen in SQL Compare as well as if you just manually scripted the object in SSMS and moved it yourself.

There are two roads to fixing it - you could specify a COLLATE clause on the join and explicitly state the collation you want to use, or you could change the destination database default collation to match the source.

I'm afraid there is no SQL Compare "magic bullet" to solve this.

Upvotes: 0

John Sansom
John Sansom

Reputation: 41819

Sounds like the collation settings for the server are different.

How are you transferring the data, do you perform a database restore on your new platform?

Either way, you need to ensure that the same collation is used on your new environment as is currently in place in your source environment.

Hope this makes sense, let me know if you need further assistance.

Upvotes: 0

Mark Broadbent
Mark Broadbent

Reputation: 411

The way I overcome this is to generate the scripts via SQL Compare and then strip out (or replace) the Collation specific code. This is relatively fast and easy to do, and finally I manually apply the scripts to the destination server/ database.

Upvotes: 0

Kristen
Kristen

Reputation: 4281

is you problem with the SQL Compare utlity, or a worry that different server collations will lead to problems?

You could change the collation of the destination server to match the Base server

If that is not possible, then make the Collation of the databases on each server match, and then your only real problem is likely to be any temporary tables which you create (they will have a default collation matching the server / TEMPDB), and so long as you explicitly create the temporary table (i.e. don't create it using SELECT * INTO #TEMP FROM MyTable) and explicitly assign a collation to any varchar/text columns you should be OK

Upvotes: 0

Console
Console

Reputation: 981

SQL Compare has an option to ignore collations. Look under the tab "options" in your compare project configuration.

Upvotes: 6

Related Questions