Registered User
Registered User

Reputation: 1564

SQL server collation concept in join?

Why having consistent collation is important when you use joins?

I've used collation while joining two tables across two databases but why we need it? If you've same collation on both tables on two different database do we need it?

Upvotes: 2

Views: 326

Answers (1)

Devart
Devart

Reputation: 121902

Collations define rules for string sorting and comparison - msdn.

Personally, I use this query style -

SELECT * 
FROM dbo.Table1 t1
JOIN dbo.Table2 t2 ON t1.KeyCD COLLATE DATABASE_DEFAULT = t2.KeyCD COLLATE DATABASE_DEFAULT 

Upvotes: 1

Related Questions