Error message 'Cannot resolve collation conflict for equal to operation'
search cancel

Error message 'Cannot resolve collation conflict for equal to operation'

book

Article ID: 55308

calendar_today

Updated On:

Products

EUREKA:Reporter

Issue/Introduction

In Microsoft SQL Server, collation can be set at the column level.

Error message  'Cannot resolve collation conflict for equal to operation' arises when comparing two columns that have different collations. For example:

SELECT ID
FROM ItemsTable
INNER JOIN AccountsTable
WHERE ItemsTable.CollationOneCol = ItemsTable.CollationTwoCol

If ItemsTable.CollationOneCol and ItemsTable.CollationTwoCol have different collation, it will generate the above error message. 

Environment

Component: EUREKA:Object-Admin Edition

Resolution

To resolve the collation conflict at the query level, add the following keywords around the "=" operator.

SELECT ID
FROM ItemsTable
INNER JOIN AccountsTable
WHERE ItemsTable.CollationOneCol COLLATE DATABASE_DEFAULT = ItemsTable.CollationTwoCol COLLATE DATABASE_DEFAULT

Collation can affect the following areas:

  1. Where clauses
  2. Join predicates
  3. Functions
  4. Databases (e.g TempDB may be a different collation database_default than the other databases)