sql server - "Cannot resolve collation conflict" even after fixing the collation -
the current database i'm using "primarydatabase" has collation "sql_latin1_general_cp1_ci_as
", while "secondarydatabase" i'm trying access has collation "arabic_ci_as
"
i changed collation secondarydatabase , set " sql_latin1_general_cp1_ci_as
" , made sure has been changed in tables.
however, when run query below still collation conflict.
select * [myserver].[secondarydatabase].[dbo].[secondarytablename] ltrim(rtrim([secondarytablename])) not in (select ltrim(rtrim(primaryfieldname)) primarytablename primaryfieldname2=1)
one way make query work use collate
clause in order apply collation cast on both fields being involved in predicate of where
clause:
select * [myserver].[secondarydatabase].[dbo].[secondarytablename] ltrim(rtrim([secondaryfieldname])) collate sql_latin1_general_cp1_ci_as not in (select ltrim(rtrim(primaryfieldname)) collate sql_latin1_general_cp1_ci_as primarytablename primaryfieldname2 = 1)
the collate
clause applied primaryfieldname
might not necessary, since default collation of corresponding database (so primaryfieldname
has collation).
another solution change collation @ field level, e.g.:
alter table secondarydatabase alter column secondaryfieldname varchar(50) collate sql_latin1_general_cp1_cs_as null
Comments
Post a Comment