Sometimes we want to query a table on a linked server, to compare with data from the local SQL Server like this:
select * from LinkServer1.Database1.dbo.Table1
where Column1 in (select Column2 from Schema1.Table2)
When we do that we may get this error:
Msg 468, Level 16, State 9, Line 1
Cannot resolve the collation conflict between “SQL_Latin1_General_CP1_CI_AS” and “Latin1_General_CI_AS” in the equal to operation.
This is because the collation is different between the two SQL Servers. To solve this convert the collation using “collate database default” like this:
select * from LinkServer1.Database1.dbo.Table1
where Column1 collate database_default in
(select Column2 from Schema1.Table2)
It worked for me. Thanks for this info.
Comment by Amit — 21 March 2019 @ 3:08 am |