码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2014-10-20 13:11:58      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   ar   strong   sp   

报错:

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

标签:style   blog   http   color   io   os   ar   strong   sp   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!