I have a column of percentages, expressed as follows:
----------
usertxt2
----------
25%
26
NULL
a%
23.00%
23.6578
I need to convert all numbers to a fixed format of xx.xx% so that the column would appear as
----------
usertxt2
----------
25.00%
26.00%
NULL
NULL
NULL
23.00%
23.66%
So far, I have tried initially removing the LEFT() function to remove the % character then converting to decimal using the CAST() function and using the CASE WHEN function to ignore blank, non-numeric characters and NULL values. How can I remove the % character and convert to numeric whilst ignoring the blank and non-numeric characters?
varchar
is asking for trouble.