" SQL_Latin1_General_CP1_CI_AS"之间的整理冲突和" SQL_Latin1_General_CP1_CS_AS"在等于操作

时间:2017-03-23 12:09:29

标签: sql inner-join collation

这是我的代码

    SELECT  
                 CASE j.ANALYSIS  
                       WHEN  'INSTALL'  THEN 'ProtectedProperty'   
                       WHEN  'REMOVAL' THEN 'UnProtectedProperty'  
                 END   AS  label ,  
                       Count(P.PROPERTYREF) AS value   
                 FROM                                                   
                       properties AS p   WITH (NOLOCK)                                      
                 INNER JOIN           
                       jobs AS j  WITH (NOLOCK)
                 ON 
                       j.PROPERTYREF = p.PROPERTYREF          
                 INNER JOIN                                      
                       LIVE_PROPS AS lp   WITH (NOLOCK)           
                 ON  
                       j.PROPERTYREF =lp.PROPERTYREF                   
                 WHERE              
                       j.Completed BETWEEN @dtmStartTime AND @dtmEndTime                  
                 AND             
                       p.OFFICE In (Select OfficeId FROM tempTbl)               

有个错误 无法解决" Latin1_General_CI_AS"之间的整理冲突和" SQL_Latin1_General_CP1_CI_AS"在等于操作。

1 个答案:

答案 0 :(得分:2)

两列之间的排序规则不同。在违规行为等于操作后添加COLLATE Latin1_General_CI_AS

例如,如果问题是LIVE_PROPS表:

INNER JOIN LIVE_PROPS AS lp WITH (NOLOCK)
     ON j.POPERTYREF = lp.PROPERTYREF COLLATE Latin1_General_CI_AS