I'm using linq to SQL and when I run this query
var lstData = from s in dataTrackDB.datas
join m in dataTrackDB.mkts on s.mktcode equals m.mktcode
join n in dataTrackDB.mktnews on m.mktcode equals n.oldmktcode
select new data
{
AccountDes = m.account,
commodity = s.commodity,
date = s.date,
daysvalid = s.daysvalid,
mktcode = s.mktcode,
mktDes = n.mktdesc,
price = s.price,
prodid = s.prodid,
statecode = s.statecode,
subcommodity = s.subcommodity,
supprecode = s.supprecode,
units = s.units
};
I will get "Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation" . I'd be thankful if someone guide me how should I write the linq query?
Thank you
Best Answer
The problem lies in
collation
of your columns in Database, change them to the same collation.setting collation on columns could affect the comparison operators in sql.
http://www.sqldbadiaries.com/2010/10/31/changing-sql-server-collation/
http://blog.sqlauthority.com/2008/12/20/sql-server-change-collation-of-database-column-t-sql-script/