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

报错:

消息 468,级别 16,状态 9,过程 XXXX,第 355 行
Cannot resolve the collation conflict between "Chinese_PRC_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.

OR 

无法解决 equal to 操作中 "SQL_Latin1_General_CP1_CI_AS" 和 "Chinese_PRC_CI_AS" 之间的排序规则冲突。

解决方案:

原语句(错误):

SELECT
a.ShopNo AS DEPTCD, c.[ShopCNName] AS DEPTNAME,a.TodayDate,
SUM(Totalamount) AS Amount
FROM
#abc a
INNER JOIN dbo.PaymentMaster b ON a.TenderNo=b.[PaymentNo]
INNER JOIN dbo.ShopMaster c ON a.[ShopNo]=c.[ShopNo]

修改后正确语句:

SELECT 
a.ShopNo AS DEPTCD, c.[ShopCNName] AS DEPTNAME,a.TodayDate,
SUM(Totalamount) AS Amount
FROM 
#abc a 
INNER JOIN dbo.PaymentMaster b ON a.TenderNo=b.[PaymentNo]
INNER JOIN dbo.ShopMaster c ON a.[ShopNo]=c.[ShopNo] collate Chinese_PRC_CI_AS

 解决方案2:

原语句:

CREATE TABLE #TMP_REALDATA( 
LINE_ID int ,
strCode VARCHAR(10)

修改后语句:

CREATE TABLE #TMP_REALDATA(
LINE_ID int ,
strCode VARCHAR(10) COLLATE DATABASE_DEFAULT,

说明:

http://msdn.microsoft.com/zh-cn/library/ms184391.aspx

三、解决方法

1.将数据库中一个表的字段改成与另一个表中要比较的字段相同的排序规则。

2.在SQL语句的Where子句后面加上类似这样的SQL片段:collate Chinese_PRC_CI_AI_WS

    如:

Select A.* From A,B Where A.a = B.b collate Chinese_PRC_CI_AI_WS


http://blog.csdn.net/xiuhaijuanqiang/article/details/9966379

原文地址:https://www.cnblogs.com/watermarks/p/4036912.html