I am trying to convert a varchar
column to money but I keep getting this error
Implicit conversion from data type varchar to money is not allowed. Use the CONVERT function to run this query.
Am I not using the convert function like the error suggests?
Select
tellerID,
SUM(CASE
WHEN CONVERT(money, value1) IS NULL THEN '0'
ELSE CONVERT(money, value1)
END) AS [Total Value 1]
From
intakedrawer
Group By
tellerID
Order By
tellerID
Try like this:
Select
tellerID,
SUM(CASE WHEN IsNumeric(value1) = 0 THEN 0
ELSE CAST(value1 AS decimal(18, 2))
END) as [Total Value 1]
From intakedrawer
Group By tellerID
Order By tellerID