无法解决查询中的排序规则冲突

时间:2014-11-26 08:46:38

标签: sql sql-server-2012

我试图选择一个视图& inner将其与SQL Server 2012中的另一个表连接,但它显示此错误

  

Msg 468,Level 16,State 9,Line 18
  无法解决" SQL_Latin1_General_CP1_CI_AS"之间的排序规则冲突和" Latin1_General_CI_AI"在等于操作。

这是我的疑问:

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

有人可以告诉我我的查询有什么问题吗?感谢

1 个答案:

答案 0 :(得分:1)

所以它是

on vpr.PARTNUMBER collate Latin1_General_CI_AI = Description1

on vpr.PARTNUMBER  = Description1 collate Latin1_General_CI_AI

取决于哪一个是整理。尝试一个,如果不正确,请尝试另一个,所需的信息不会在你的帖子中告诉你它是哪一个。