replace or remove characters and then cast to decimal
sql, sql-server
Solution
try this:
CAST (replace (p16.pa_value,'%','') AS DECIMAL (3,0)) as discount2
Problem
I need to remove or replace an unwanted haracter `(%)` wich is in the end of a string and thyen to cast the string to a decimal, because I need to get the sum of 2 fields named `discount1` and `discount2` The last combination I tried is: ``` replace ((p16.pa_value,'%','')CAST (p16.pa_value AS DECIMAL (3,0))) as discount2, ``` It seems to be super wrong as the `CAST` is inside of the `replace` statement