I tried using patindex to find the starting of the number value in a string. My goal is to just extract the numeric part from the string excluding the %.
With the below query, here are my results :
Select Column_Desc, Replace(substring([Column_Desc], PatIndex('%[0-9]%', [Column_Desc]), len([Column_Desc])),'%','') as New_Value
Column_Desc
- My tax rate is 18.8% **.
- 13.8% is my tax rate.
- My tax rate 15.9% What is yours ?
New_Value
- 18.8
- 13.8 is my tax rate.
- 15.9 What is yours?
So, the result(New_Value) should be 18.8, 13.8 and 15.9 with a datatype of decimal. I am unable to get it to work. Please advise. Thank you!