Then cast(('1/' + Tot_Carton + ' - ' + Tot_Carton - 1 + '/' + Tot_Carton + ' & ' + Tot_Carton + '/' + Tot_Carton + ' ' + Loose_Qty) as varchar(30))Įlse cast(('1/' + Tot_Carton + ' - ' + Tot_Carton + '/' + Tot_Carton) as varchar(30))Įlse (case when cast(Loose_Qty as varchar(15)) >= 1. Then (case when cast(Loose_Qty as varchar(15)) >= 1.00 Based on your snippet, it might be easier to do this with dynamic SQL to construct the ORDER BY clause more cleanly. You could try converting Rating to a varchar, or returning 0 or NULL instead of a string. Because SQL Server can't convert '' to a numeric data type. Then (case when cast(SubQuery1.OrderDtl_IUM as varchar(10)) = 'GRS' Msg 8114, Level 16, State 5, Line 4 Error converting data type varchar to numeric. In order to resolve the conversion error, you just need to remove the comma (,) from the varchar value that you want to convert to numeric. (case when cast(SubQuery1.UD100A_NoofPcsPerCarton_c as varchar(15)) > 0.00 At least one row in your DB contains non-numeric data and SQL can't convert it. 2 solutions Top Rated Most Recent Solution 1 This is a good idea, but.your table data is already corrupt. What is happening there I have already converted to numeric if accountcode valid, but it seems the query is. Check your table's column data should not contain VARCHAR value. In the above error message, if you have noticed, data type numeric is. I am creating a BAQ with a calculated column to show carton number in a format “1/557 - 556/557 & 557/557 6.0” (meaning total carton number 557, with the last carton number 557 with loose quantity of 6)īelow is my calculated column formula in BAQ, however, i get error messages on this column.Įrror: Text: Arithmetic overflow error converting varchar to data type numeric. Error converting data type varchar to numeric. In such scenarios, it is ideal to use Sql Decimal data type in SQL Server to.
0 Comments
Leave a Reply. |