Thursday, September 15, 2016

Cannot resolve the collation conflict between "Latin1_General_BIN" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.

Problem:
I was trying to migrate data from one catalog to the other and hit this error. 


insert claim

select

*

from [MANNHEIM].dbo.CLAIM c

Inner Join Exercise e

on e.Exercise_ID = c.EXERCISE_ID

where e.EXERCISE_ID is not null


The problem was that the field in the source table had a different default format then
the target field.  The way around was to force the query to use a common default collation.




Solution:


insert claim
select
from [MANNHEIM].dbo.CLAIM c
Inner Join Exercise e
on e.Exercise_ID COLLATE DATABASE_DEFAULT = c.EXERCISE_ID COLLATE DATABASE_DEFAULT
where e.EXERCISE_ID is not null


Source:
http://blog.sqlauthority.com/2007/06/11/sql-server-cannot-resolve-collation-conflict-for-equal-to-operation/

No comments:

Post a Comment