I have a field called 'description', that cna include a number of abbreviations that do not have to be in a specific order. However if a charge for mileage isi ncluded in the list it is always in this pattern M:100.00 @:.56 - but the values can vary like M:12.00 @:.565 these can be at the begining of the string or anywhere in it.
Example M:30.8 @:0.55 P:.00 R:.00 C:Hotel to client
or
B:.00 L:.00 D:45.46 R:.00 M:50.0 @:0.55 T:20.00 O:747.41 I:.00 A:840.37 C:rsm
I have to parse out the M value and the @value and mutliply them.
I have been trying to do this with SUBSTRING AND CHARINDEX but I must be missing something. ANyone have a solution?
SELECT
SUBSTRING(w.description,PATINDEX('%M:%@:%',w.description),charINDEX(':',w.description,CHARINDEX('@:',w.description,0)+2)), w.descriptionFROM t_wip wwheredescriptionlike'%M:%@:%'
and
date_effective between'2010-01-01'and'2010-01-11'