Re: Cleaning muck out of data fields

2005-05-13 Thread Philippe Poelvoorde
Hi, update tbl_products set p10_price=mid(p10_price,2) where p10_price regexp ('[^0-9.]'); Which worked because the mucky characters were always the first two digits but it's still cludgy. What I really wanted to do was just "filter out the good any currency numerics of form \d+.\d\d 10.95 but a

Re: Cleaning muck out of data fields

2005-05-13 Thread zzapper
On Fri, 13 May 2005 08:29:46 +0200, wrote: >Hi, >if the first characters are numerics, no need to use regexp, since mysql does >implicit conversion if you do calculations : > >mysql> select '10.95 tiitti' from dual; >+--+ >| 10.95 tiitti | >+--+ >| 10.95 tiitti | >+---

Re: Cleaning muck out of data fields

2005-05-12 Thread mfatene
Hi, if the first characters are numerics, no need to use regexp, since mysql does implicit conversion if you do calculations : mysql> select '10.95 tiitti' from dual; +--+ | 10.95 tiitti | +--+ | 10.95 tiitti | +--+ 1 row in set (0.09 sec) mysql> select '10.95

Cleaning muck out of data fields

2005-05-12 Thread zzapper
Hi, I wanted to clean up some numeric currency data fields which had some non-numeric values which took the first two characters of the field (they were some kind of garbage characters) anyway the following did the trick update tbl_products set p10_price=mid(p10_price,2) where p10_price regexp