SQL:两个不同排序规则之间的排序规则冲突

时间:2022-09-25 15:39:31

I am having trouble with this error

我遇到了这个错误

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

“无法在等于操作的”SQL_Latin1_General_CP1_CI_AS“和”Latin1_General_CI_AS“之间解决排序规则冲突。”在SSMS中。

I know this means my columns are not having the same collation and i have looked up for a solution and tried changing the collation. They both have the same collation but I still get the same error.

我知道这意味着我的列没有相同的排序规则,我已经找到了解决方案,并尝试更改排序规则。它们都具有相同的排序规则,但我仍然得到相同的错误。

How do i fix it? This is my script :

我如何解决它?这是我的脚本:

`INSERT INTO EVoucherBatchMapping_New(EVoucherBatchValidityID,
                                    EventCode,
                                    ArrivalDate,
                                    DepartureDate,
                                    NoShowCharge)
SELECT                              EVoucherBatchValidityID,
                                    EventCode,
                                    ArrivalDate,
                                    DepartureDate,
                                    NoShowCharge
 FROM EVoucherBatchMapping
WHERE ArrivalDate BETWEEN '2015-01-01' AND GETDATE() 
AND EXISTS(SELECT * FROM PromotionEvent_New where EVoucherBatchMapping.EventCode = PromotionEvent_New.EventCode) `

1 个解决方案

#1


0  

You could alter the column definitions to use the same collation or give the collation you want to use in the sub query:

您可以更改列定义以使用相同的排序规则,或者在子查询中提供要使用的排序规则:

SELECT * FROM PromotionEvent_New 
WHERE 
EVoucherBatchMapping.EventCode = PromotionEvent_New.EventCode
COLLATE SQL_Latin1_General_CP1_CI_AS;

or

要么

SELECT * FROM PromotionEvent_New 
WHERE 
EVoucherBatchMapping.EventCode = PromotionEvent_New.EventCode
COLLATE Latin1_General_CI_AS;

#1


0  

You could alter the column definitions to use the same collation or give the collation you want to use in the sub query:

您可以更改列定义以使用相同的排序规则,或者在子查询中提供要使用的排序规则:

SELECT * FROM PromotionEvent_New 
WHERE 
EVoucherBatchMapping.EventCode = PromotionEvent_New.EventCode
COLLATE SQL_Latin1_General_CP1_CI_AS;

or

要么

SELECT * FROM PromotionEvent_New 
WHERE 
EVoucherBatchMapping.EventCode = PromotionEvent_New.EventCode
COLLATE Latin1_General_CI_AS;