Doing a join across two databases with different collations on SQL Server and getting an error.

Posted by Andrew G. Johnson on Stack Overflow See other posts from Stack Overflow or by Andrew G. Johnson
Published on 2010-02-18T17:33:26Z Indexed on 2010/05/09 14:18 UTC
Read the original article Hit count: 286

Filed under:
|

I know, I know with what I wrote in the question I shouldn't be surprised. But my situation is slowly working on an inherited POS system and my predecessor apparently wasn't aware of JOINs so when I looked into one of the internal pages that loads for 60 seconds I see that it's a fairly quick, rewrite these 8 queries as one query with JOINs situation. Problem is that besides not knowing about JOINs he also seems to have had a fetish for multiple databases and surprise, surprise they use different collations. Fact of the matter is we use all "normal" latin characters that English speaking people would consider the entire alphabet and this whole thing will be out of use in a few months so a bandaid is all I need.

Long story short is I need some kind of method to cast to a single collation so I can compare two fields from two databases.

Exact error is:

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

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about collation