sql server collation conflict

To resolve the collation conflict add following keywords around "=" operator.

SELECT ID FROM ItemsTable INNER JOIN AccountsTable WHERE ItemsTable.Collation1Col COLLATE DATABASE_DEFAULT= AccountsTable.Collation2Col COLLATE DATABASE_DEFAULT
<div style="overflow-x: scroll;"> <div style="width: 1324px;"> SELECT ID FROM ItemsTable INNER JOIN AccountsTable WHERE ItemsTable.Collation1Col COLLATE DATABASE_DEFAULT= AccountsTable.Collation2Col COLLATE DATABASE_DEFAULT </div> </div>
  1. <code>
  2. <div style="overflow-x: scroll;">
  3. <div style="width: 1324px;">
  4. SELECT ID FROM ItemsTable INNER JOIN AccountsTable WHERE ItemsTable.Collation1Col COLLATE DATABASE_DEFAULT= AccountsTable.Collation2Col COLLATE DATABASE_DEFAULT
  5. </div>
  6. </div>
  7. </code>
<code>
<div style="overflow-x: scroll;">
<div style="width: 1324px;">
SELECT ID FROM ItemsTable INNER JOIN AccountsTable WHERE ItemsTable.Collation1Col COLLATE DATABASE_DEFAULT= AccountsTable.Collation2Col COLLATE DATABASE_DEFAULT
</div>
</div>
</code>
Collation can affect following areas:
1) Where clauses
2) Join predicates
3) Functions
4) Databases (e.g. TempDB may be in a different collation database_default than the other databases some times)

Popular posts from this blog

Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=xx.0.0.0, Culture=neutral, PublicKeyToken='xxx' or one of its dependencies.

C# Crop white space from around the image

The specified version string contains wildcards, which are not compatible with determinism.