SQL Server – Handling Collation Mismatches

collationlinked-serversql server

Imagine the following scenario: I have two servers which are on two separate private networks.

A linked server has been created, and there is a table in server A which has an updated version of the same table on server B. The updates are not extensive, essentially just a reassignment of some Boolean values.

The connection between the two servers is reliable but relatively slow, and there is a collation mismatch between the two tables.

Is there a recommended or standard way of updating information between two servers with a collation mismatch?

Best Answer

You use the collate operator in the join. Such as:

select <column list>
from dbo.firsttable f
join linkedserver.database.dbo.secondtable d 
   on f.name collate database_default = d.name collate database_default 

Of course, you can also specify a specific collation, such as: SQL_Latin1_General_CP1_CI_AI