I’m trying to sum a column of varchar data, however the values all have commas and decimal points in them. It appears that the query cannot convert a string to a decimal. Help!

I have tried the below query and keep getting the below error message:

SELECT SUM(Cast(“Repaid to IDA (US$)” as DECIMAL(10,4)))
FROM “banking_table”
WHERE “Country” = ‘Bolivia’;

error message:
Conversion Error: Could not convert string “12,063,443.31” to DECIMAL(10,4)

New contributor

leomhujr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.