2017-06-22 72 views
1
I am getting the following error 

無法解析的等於操作「Latin1_General_BIN」和 「Latin1_General_CI_AS」之間的排序規則衝突。無法解析「Latin1_General_BIN」,並在平等的「Latin1_General_CI_AS」之間的排序規則衝突操作

代碼

SELECT @PARTS = SUM(Llines_1.[qty]) from pick 
RIGHT OUTER JOIN op AS Llines_1 ON pick.picknote = 
Llines_1.[order_no] WHERE (pick.batchid = @batchid) AND (product = @product) 
group by product Order By product 

我已經厭倦了使用COLLATE SQL_Latin1_General_CP1_CI_AS前從,但仍然得到同樣的錯誤。

SELECT @PARTS = SUM(Llines_1.[qty]) COLLATE SQL_Latin1_General_CP1_CI_AS 
from pick RIGHT OUTER JOIN op AS Llines_1 ON pick.picknote = Llines_1. 
[order_no] WHERE (pick.batchid = @batchid) 
AND (product = @product) group by product Order By product 
+0

,請複製粘貼代碼'COLLATE'。哪些列有不同的排序規則? –

+0

編輯原稿以包含COLLATE的代碼。我不確定哪些列有不同的排序規則,我將如何確定它? – Emma

+0

Emma,您可以在SSMS中的列的屬性頁面中查看排序規則 –

回答

1

我假設的picknoteorder_no排序規則是不同的 試試這個:

SELECT @PARTS = SUM(Llines_1.[qty]) 
from pick 
RIGHT OUTER JOIN op AS Llines_1 ON pick.picknote = Llines_1.[order_no] COLLATE SQL_Latin1_General_CP1_CI_AS 
WHERE (pick.batchid = @batchid) 
    AND (product = @product) group by product Order By product 
+0

現在我得到此錯誤..表達式類型float對於COLLATE子句無效。 – Emma

+0

picknote是nvarchar(50),order_no是char(10) – Emma

+0

一分鐘,仍然有第一個COLLATE在那裏,現在將刪除。 – Emma

相關問題