Cannot resolve the collation conflict?
I had this error and I don't know how to fix it
Cannot resolve the collation conflict between "Arabic_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.
note: I already change the collation from the database option --> Coll开发者_高级运维ation
I change it from "Arabic_CI_AS" to "SQL_Latin1_General_CP1_CI_AS"
and I am still getting the same error !!
Any suggestion to solve this ?The database collation applies only when you create NEW objects without specifying the collation.
When you change it from "Arabic_CI_AS" to "SQL_Latin1_General_CP1_CI_AS", all the textual columns in the database are still collated Arabic_CI_AS
. You can check this using
select object_name(object_id), name, collation_name
from sys.columns
where collation_name like '%Arabic%'
A patch to this problem is to put COLLATE DATABASE_DEFAULT
against the comparison, e.g.
SELECT *
FROM TBL1
INNER JOIN TBL2 on X = Y COLLATE DATABASE_DEFAULT
or
SELECT *
FROM TBL1
WHERE X = Y COLLATE DATABASE_DEFAULT
etc
There is a script on this site that attempts to change the collation across an entire database, but
- I have not personally tried it
- Make sure you have a good backup of your database before trying it
- It doesn't look like it will handle complex databases with indexed views, foreign key/default constraints etc
精彩评论