Alvan
Alvan

Reputation: 39

Cannot resolve the collation conflict in my query

I'm trying to select a view & inner join it with another table in SQL Server 2012 but it is showing this error

Msg 468, Level 16, State 9, Line 18
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AI" in the equal to operation.

This is my query:

SELECT 
    vpr.PARTNUMBER, vpr.DESCRIPTION, 
    vpr.BUYER, vpr.[GL CLASS], vpr.[ABC CODE], 
    vpr.TODAY, vpr.DAY1, vpr.DAY2, vpr.DAY3, vpr.DAY4, vpr.DAY5, 
    vpr.[COO QTY], 
    ROUND(vpr.[QOH-MSTORE], 0) AS [QOH-MSTORE], 
    vpr.[QOH-COO], vpr.[QOH-SDV], 
    ABS(ROUND(vpr.TOPUPQTY, 0)) AS [TOPUPQTY],
    (CASE 
        WHEN ABS(ROUND(vpr.TOPUPQTY, 0)) < vpr.[QOH-SDV] THEN ABS(ROUND(vpr.TOPUPQTY, 0))
        WHEN ABS(ROUND(vpr.TOPUPQTY, 0)) >= vpr.[QOH-SDV] THEN vpr.[QOH-SDV]
     END) AS [SDV TO PICK]
FROM 
    vw_PartsReport vpr
LEFT JOIN
    (SELECT twudc.Description1 
     FROM tbl_WH_UserDefineCodes twudc
     WHERE twudc.UserDefineCodes = 'SO'
     GROUP BY twudc.Description1) AS [SOI] ON vpr.PARTNUMBER = Description1
WHERE 
    vpr.TOPUPQTY <= 0

Can someone please advise me what's the problem with my query? Thanks

Upvotes: 1

Views: 3353

Answers (1)

Tristan
Tristan

Reputation: 1014

So it's either

on vpr.PARTNUMBER collate Latin1_General_CI_AI = Description1

or

on vpr.PARTNUMBER  = Description1 collate Latin1_General_CI_AI

depending on which one is which collation. try one and if it's not right try the other, the required information isn't in your post to tell you which one it is.

Upvotes: 3

Related Questions