Comment resoudre un problème de collation lors d'une jointure avec 2 colonnes de type varchar mais ayant type de collation different avec MS Sql Serveur ?

 

En essayant de faire une jointure sur 2 tables ayants des colonnes de type varchar avec un type de collation different et Sql Serveur retourne ce type d'erreur :

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

Resolution :

select *
from Table1
inner join Table2 on Table1.ColVarchar = Table2.ColVarchar Collate Latin1_General_CS_AI

 

del.icio.us tags:

2 commentaires:

Anonyme a dit…

Thanks for the tip. I had an issue with a migration from SQL2005 32bit to SQL2005 64bit where I was receiving the following error. By updating the collation statement on my Where clause, I was able to fix the problem.

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

Fixed: WHERE (NessusScanner.Systems.SystemName = teh.SystemName COLLATE Latin1_General_CS_AI)

Titia765 a dit…

Thanx, guy! I had this issue with a DB which collation isn't the same as tempdb's.
Everything solved! Next Issue :-)