Problems / Parse Currency Amounts / Editorial
replace(replace(amount, '$', ''), ',', '')
replace
regexp_replace(amount, '[$,]', '', 'g')
$
'g'
DOUBLE
DECIMAL
'$18,750.00'
18750.0
SUM
department
ROUND(..., 2)
Display formats are for humans; storage should be numeric. When a legacy system hands you formatted strings, parsing is a two-step discipline: normalize (strip every non-numeric decoration, not just the first occurrence) then cast. The sneaky bug is a partial cleanup — removing $ but forgetting , — which errors (or NULLs) only on amounts ≥ $1,000, so small test samples pass while the real total silently drops the largest expenses.
,
Solve Parse Currency Amounts yourself →