Cannot resolve the collation conflict between "SQL_Latin1_General_Pref_CP1_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.

I get this error when trying to join 2 fields.  Can anybody tell me what this is and how to make the join work?

Cannot resolve the collation conflict between "SQL_Latin1_General_Pref_CP1_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ValentinoVBI ConsultantCommented:
Let's say you've got the following: on A = B

When both A and B are string fields they have a collation that defines how the characters are stored. To compare both need to be equal.  When they are not you get the error which you're seeing.  One option to handle this is by using the COLLATE statement:

on A COLLATE SQL_Latin1_General_CP1_CI_AS = B COLLATE SQL_Latin1_General_CP1_CI_AS

Info: Collations
Pawan KumarDatabase ExpertCommented:
Since the fields are from different collation you have to change collation on the fly like any of the below..

NOTE - This issue can come only for WHERE CLAUSE, JOIN, In etc.. only for string fields.

Collation in MS SQL Server is used for specifying the ordering of characters when you create or alter a table or create a domain. Collation settings, which include character set, sort order, and other locale-specific settings, are fundamental to the structure and function of Microsoft SQL Server databases. SQL Server uses them implicitly in SQL statements. To use them explicitly you need to override the default collation or the collation you specified when creating or altering the table or creating the domain. Collation can be applied for char, varchar, text, nchar, nvarchar, and ntext data types


on col1 COLLATE SQL_Latin1_General_CP1_CI_AS = col2 COLLATE SQL_Latin1_General_CP1_CI_AS




on col1 COLLATE SQL_Latin1_General_Pref_CP1_CI_AS= col2 COLLATE SQL_Latin1_General_Pref_CP1_CI_AS

READ more from -

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vbnetcoderAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.