Wednesday, February 15, 2012

Error message

Hello,

When I try to run a query on a server, I get the following error:

"Cannot resolve collation conflict for equal to operation."

The same query, but on another server works without any problems.

Any idea how I can resolve this?You are joining two different coallations which each other. To solve the collation conflict you will have to either change the collation on the server / database / table / or expression server you are using (whereas the latter is the quickfix for your problem. It has be to implemented whereever you are joining different collations:

select ca.account_status, cs.code from customer as ca
inner join v_customer_status as cs on ca.account_status = cs.description COLLATE SQL_Latin1_General_CP1_CI_AI

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de|||Thanks Jens.

But the query contains tables of the same database.|||That is not just related to different databases. Also just columns within a table can have a different collation. QUery the INFORMATION_SCHEMA.Columns to see which Collation they have and use the mentioned keyword and syntax to use a common collation.

HTH, Jens.|||txs Jens.

I saw some different entries in the syscolumns under the field collation.
Unfortunately I cannot change the collation name.

What can I do (apart from changing my queries)?|||Is there any specific reason why you have different collation settings for tables in the same database? Unless you're willing to "sweat it out" the easiest way is to change the collation settings of one table to be the same as the other.|||I copied the tables from another server, apparently with a different collation setting.

How can I change this setting per table?|||I think there is no command for changing every column within the table. YOu will have to change this by column with the command:

ALTER TABLE <tablename> ALTER COLUMN colname <datatype> COLLATE <collationname>

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment