So I'm exploring a table where I found a couple of fields that should be numerics, however as the source is an excel file so people have mixed already letters, symbols, and numbers.
I'm trying to clean up these fields but I can find too many kinds of symbols so currently, I've performed the cleaning with a couple of cases like:
SELECT
CASE
WHEN Montant_Devise LIKE '%Free%' THEN '0'
WHEN Montant_Devise LIKE ' ' THEN '0'
WHEN Montant_Devise = '' THEN '0'
WHEN Montant_Devise = '-' THEN '0'
ELSE CAST(COALESCE(RTRIM(LTRIM(REPLACE(REPLACE(REPLACE(Montant_Devise, '€', ''), ' ', ''), ',', '.'))), '0') AS DECIMAL(20,2))
END
FROM
[dbo].[table_BI]
So, the deal here is that probably I may find new symbols in the future than to avoid include the new symbols in my case I would like to know how could I replace doesn't matter which symbol or letter by the default 0 zero.
Do you know guys how I could do this?
Thanks