While writing a query with joining two tables from two different dbs, a collation error was encountered. 'Cannot resolve collation conflict for equal to operation.' Fix:
add keyword COLLATE DATABASE_DEFAULT after join .
COLLATE DATABASE_DEFAULT
SELECT <columnname> FROM <dbname1>.<dbo>.table1 t1 INNER JOIN<dbname1>.<dbo>.table1 t2 ON t1.colx = t2.coly COLLATE DATABASE_DEFAULT
Published under: General Technology Tips · · · ·
Please note that changing the collation changes the way SQL Server interprets string values - the result of a string comparison after changing the collation may be different than expected.