Cannot resolve the collation conflict in my query

笑着哭i 提交于 2019-12-10 12:14:28

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/27144684/cannot-resolve-the-collation-conflict-in-my-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!