Cannot resolve the collation conflict between 2 Collations

Posted: 2013-09-26 in Sql

Msg 468, Level 16, State 9, Procedure XXXXXX_Select_XXXXXXXXXXX_FILTERED, Line 11
Cannot resolve the collation conflict between “Finnish_Swedish_CI_AS” and “SQL_Latin1_General_CP1_CI_AS” in the equal to operation.

If your unlucky and need to be join tables or database which have different collation set then the above message is frequent. Luckily the fix isn’t tooo hard


--Throws Collation Error assuming table a column is set as Swedish or something similar
Select *
From TableA
INNER JOIN TABLEB ON a.Name = b.Name


--Work.. With collation force to latin (same as table b)
Select *
From TableA
INNER JOIN TABLEB ON a.Name  COLLATE SQL_latin1_general_CP1_ci_as = b.Name

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s