Recently, DBA attached a copy of our a SQL 2000 mdf file to our new SQL 2012 server. I had a join query on two different databases within the same server, I ran into this error.
Cannot resolve the collation conflict between "SQL_Latin1_General_CP437_CI_AS"
and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.
Turns out to be SQL 2000 database and SQL 2012 had two different collations and the cross database queries should be written as shown below
select <cols>
from <table1> t1 join <table2> t2 on
t1.col1 = t2.c1 COLLATE Database_Default
where t1.c1 = 'Blah'
The sys.databases would have the collation name of the database
No comments:
Post a Comment