Updating phone numbers

  • Thread starter Thread starter Karlos
  • Start date Start date
K

Karlos

hello,

Is there some sort of update query I can run to update
phone numbers?

In a table i have a field that holds phone numbers. the
field has a text data type and is a mixture of phone
numbers and also some text.

the phone numbers now need to have an 8 in front of them.

so i need to be able to update all phone numbers to start
with an 8 but leave the text as it is.

any ideas??
 
Hi,


Make a backup.


UPDATE tableName
SET phoneNumber = "8" & phoneNumber



should do.


Hoping it may help,
Vanderghast, Access MVP
 
How can you distinguish the Phone Numbers from the "Text"? Doe the "Text"
always contain at least one non-numeric character? Or are the phone numbers
always of the same number of numeric characters and in the same pattern?

A possibility if phone number is always like 999 812-9999 or 999.812.9999 is to
use SQL that looks like the following.

UPDATE YourTable
SET PhoneNumber = "8" & PhoneNumber
WHERE PhoneNumber Like "###?###?####"
 
Hi,

the phone numbers are all 4 digit numbers, but we are
getting them changed so they will all start with an 8
 
Hi,


Yep. See John's post... you have to add a where clause after you found
a criteria that identify the "text" entry, if you want to only update those.



Vanderghast, Access MVP
 
brilliant....that worked a treat...thanks

-----Original Message-----

How can you distinguish the Phone Numbers from the "Text"? Doe the "Text"
always contain at least one non-numeric character? Or are the phone numbers
always of the same number of numeric characters and in the same pattern?

A possibility if phone number is always like 999 812-9999 or 999.812.9999 is to
use SQL that looks like the following.

UPDATE YourTable
SET PhoneNumber = "8" & PhoneNumber
WHERE PhoneNumber Like "###?###?####"

.
 
Back
Top