Deployment issue after doing code first development with entity framework
The issue I got is collation conflict between dev computer and staging server.
On dev computer, somehow the default collation is set to my local language while the staging server is using SQL_Latin.
After I generated a deployment package and about to import sql, the error came out.
It generally says
Cannot resolve the collation conflict between 'xxxxxx'
and 'SQL_Lati开发者_如何学编程n1_General_CP!_CI xxx' in the equal to operation.
There are various ways to solve this on a PER-QUERY basis, but what you really need to do is to change the collation of the database or server (whichever you can) so that they match. It is really hard to work with server/db collation mismatches.
My pick would be to reinstall SQL Server on your DEV server/desktop (or add another instance) that will match the collation of the target staging/production server.
A query specific fix would be to add a collation clause whenever two [n][var]char columns are compared, e.g.
SELECT *
FROM TBL A, TBL2 B
WHERE A.COL1 = B.COL2 collate Latin1_General_CI_AS
Some previous questions here that will give you a better idea of what you are up against
- SQL Server - is there a way to mass resolve collation conflicts
- Cannot resolve collation conflict in Union select
- SQL Collation conflict when comparing to a column in a temp table
精彩评论