SQL Server – Cannot resolve collation conflict

A friend of mine contacted me through email today having a very common problem with a query he had written.  He received an error, “cannot resolve collation conflict for equal to operator”.

Early in my career I had experienced the same issue so I quickly searched my code snippets and found where I had used COLLATE DATABASE_DEFAULT after each of the comparison columns.  For example

SELECT COLUMN
FROM TABLE_A
INNER JOIN TABLE_B
WHERE TABLE_A.COLUMN COLLATE DATABASE_DEFAULT = TABLE_B.COLUMN COLLATE DATABASE_DEFAULT

If you experience the error “Cannot resolve collation conflict for equal to operator” I hope this solution helps you out.

Leave a Reply

Your email address will not be published. Required fields are marked *