I need to parse a column into two columns filtering out the first 4 characters and converting the fraction into a decimal and the others that apply e.g. 10GA to decimal also. In the second column I need to parse from 6 to the next space.
This is what I have so far. I have the fraction conversion worked out, but if there is e.g. 1" it does not work. I also need to come back and convert a value of 10 GA where on the first run it was 10GA.
Description
1/4 GR80 16.75" X 17.15"
3/16 HR 96'' x 261''
1/2 HR 17.00'' x 20.00''
5/8 HR 12.00'' x 22.375''
3/8 HR 2.25" X 5.05"
1/2 GR50 10.13'' x 12.00'
10GA HR 25.13" X 82.97",0.135
10 GA HR 37.44" X 79.19"
1" HR 8.25" x 22.75"
SELECT description,CASE Left(cast(description as varchar(4)), 30)
WHEN '1/8' then '0.125'
WHEN '3/16' then '0.187'
WHEN '5/16' then '0.313'
WHEN '10GA' then '0.135'
WHEN '10 GA' then '0.135'
WHEN '1"' then '1.000'
END as 'tcode'
FROM jobasmbl
All suggestions and help welcomed and appreciated.
This is what I have so far. I have the fraction conversion worked out, but if there is e.g. 1" it does not work. I also need to come back and convert a value of 10 GA where on the first run it was 10GA.
Description
1/4 GR80 16.75" X 17.15"
3/16 HR 96'' x 261''
1/2 HR 17.00'' x 20.00''
5/8 HR 12.00'' x 22.375''
3/8 HR 2.25" X 5.05"
1/2 GR50 10.13'' x 12.00'
10GA HR 25.13" X 82.97",0.135
10 GA HR 37.44" X 79.19"
1" HR 8.25" x 22.75"
SELECT description,CASE Left(cast(description as varchar(4)), 30)
WHEN '1/8' then '0.125'
WHEN '3/16' then '0.187'
WHEN '5/16' then '0.313'
WHEN '10GA' then '0.135'
WHEN '10 GA' then '0.135'
WHEN '1"' then '1.000'
END as 'tcode'
FROM jobasmbl
All suggestions and help welcomed and appreciated.