首页 > 代码库 > Cannot resolve the collation conflict between "Chinese_PRC_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.
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.
解决方案:
原语句(错误):
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
说明:
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
Cannot resolve the collation conflict between "Chinese_PRC_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.