I am trying to convert currency values stored as a string to decimal. In my dataset, there is a currency column with values like $15,000.50 stored as varchar. I am trying to convert it to 15000.50
I tried SELECT CONVERT (decimal , '$15,000.50 ') but end up with the dreaded conversion type error. In another scenario I tried to replace "$" with a blank like so and it worked
select CONVERT(decimal (10,2),replace('$50.50','$',''))
This wouldn't work in my first example because of the $ and comma in the value. Is there a method to do this more efficiently ?