I have a column in a data set that contains a currency indicator and the corresponding amount of that currency (i.e USD 35,000.05). I am trying to get the substring of the column containing the number and convert it to a decimal. However, whenever I convert it, it only returns the first two digits of the number I am trying to get.
For example, this is what happens:
In this sample, this is my query:
SELECT
SUBSTRING(`Annualized Opportunity Amount`,1,3) as `test1`,
(SUBSTRING(`Annualized Opportunity Amount`,5)) as test2,
case when SUBSTRING(`Annualized Opportunity Amount`,1,3) = 'AUD'
then CAST(SUBSTRING(`Annualized Opportunity Amount`,5) AS DECIMAL(10,2))
else 0 END as `test3`
from annualized_opportunity_revenue
Is there any reason as to why only the first 2 digits of the test2 column would be returned in test3? The substrings for the resulting value are the same so I don't understand why casting it would alter the data.
Any help will be appreciated, thank you.

,first,12,345isn't a number. Store number as number, then there will be no problem.select cast(replace(dacolumn, ',' , '') as decimal(10,2))