您的位置:首页 > 博客中心 > 数据库 >

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

时间:2022-03-14 01:16

报错:

消息 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

 

说明:

三、解决方法

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


热门排行

今日推荐

热门手游