By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
with t as (
select v.*
from (values ('My tax rate is 18.8% **.'),
('13.8% is my tax rate.'),
('My tax rate 15.9% What is yours ?')
) v(Column_Desc)
)
select Column_Desc,
convert(decimal(5, 2),
left(stuff(Column_Desc, 1,
patindex('%[0-9]%', Column_Desc) - 1, ''), 4)
) as new_value
from t
Column_Desc | new_value |
---|---|
My tax rate is 18.8% **. | 18.80 |
13.8% is my tax rate. | 13.80 |
My tax rate 15.9% What is yours ? | 15.90 |