Results 1 to 2 of 2
Thread: Need help with another SQL query
Jan 13, 2013, 15:31 #1
Need help with another SQL query
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?
Split Light Designs
Bringing your ideas to light.
Jan 14, 2013, 09:24 #2
- Join Date
- Jul 2002
- Toronto, Canada
- 58 Post(s)
- 3 Thread(s)
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 '(___)____-____'