user5597530
user5597530

Reputation:

SQL: Collation conflict between two different collations

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.

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) `

Upvotes: 0

Views: 9019

Answers (1)

Mithrandir
Mithrandir

Reputation: 25337

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;

Upvotes: 1

Related Questions