I am getting the following error
Cannot resolve the collation conflict between "Latin1_General_BIN" and "Latin1_General_CI_AS" in the equal to operation.
Code
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
I have tired using COLLATE SQL_Latin1_General_CP1_CI_AS before the from but still get the same error.
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
Common collation names either end in _BIN or _CI_AS such as Latin1_General_BIN or SQL_Latin1_General_CI_AS. The _BIN means that this is a binary sort order where strings will be sorted using a computer binary order, the result is that A-Z are before a-z and things like accented characters will be at the end.
The SQL_Latin1_General_CP1_CI_AS collation is a SQL collation and the rules around sorting data for unicode and non-unicode data are different. The Latin1_General_CI_AS collation is a Windows collation and the rules around sorting unicode and non-unicode data are the same.
In Microsoft SQL Server, the collation can be set at the column level. When you compare (or concatenate) two columns having different collation in a query, this error occurs: Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "French_CI_AS" in the equal to operation. —
MSDN states COLLATE DATABASE_DEFAULT clause casts the collation of an expression, column definition, or database definition to inherit the collation of the "current database". To complement MSDN, the "current database" is the context of the database where the query is executed.
I assume that collations of picknote
and order_no
are different
Try this:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With