HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

SQL Server ; working around collation mismatches

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
aroundsqlworkingmismatchescollationserver

Problem

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?

Solution

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

select 
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

Code Snippets

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

Context

StackExchange Database Administrators Q#99039, answer score: 5

Revisions (0)

No revisions yet.