I have a few telephone numbers for each record in a table. I want to search all fields within a table for telephone numbers in the format of:
(123) 555-5555 and change it to 123-555-5555
How would I go about doing that?
Many thanks,
Houston
| SitePoint Sponsor |
I have a few telephone numbers for each record in a table. I want to search all fields within a table for telephone numbers in the format of:
(123) 555-5555 and change it to 123-555-5555
How would I go about doing that?
Many thanks,
Houston


assuming there's nothing before or after the phone number...
also assuming mysql, because, well, because you didn't specify your database system...Code:UPDATE daTable SET daColumn = CONCAT( SUBSTRING(daColumn FROM 2 FOR 3) -- 213 , '-' , SUBSTRING(daColumn FROM 7 FOR 9) -- 555-5555 ) WHERE daColumn LIKE '(___)____-____'
Bookmarks