Use an update query for Phone Number fields

G

Guest

I have a table that has phone numbers stored in 1 of 2 formats.
(555)555-5555
(555) 555-5555

I have checked and the data is actually stored like this. I would like to
do an update query that puts the phone numbers in the format 5555555555 but i
haven't been able to achieve this.
Thanks in advance for the help.
 
D

David Lloyd

One alternative is to use the Replace function to remove the unwanted
characters. For example:

UPDATE MyTable SET [PhoneNumber] =
Replace(Replace(Replace(Replace([PhoneNumber],"(",""),")",""),"
",""),"-","")

If you need to update only a portion of the phone numbers in the table, you
can add a WHERE clause to the above query.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


I have a table that has phone numbers stored in 1 of 2 formats.
(555)555-5555
(555) 555-5555

I have checked and the data is actually stored like this. I would like to
do an update query that puts the phone numbers in the format 5555555555 but
i
haven't been able to achieve this.
Thanks in advance for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top