Click here to Skip to main content
14,452,520 members
Rate this:
Please Sign up or sign in to vote.
See more:
In the Access database I have about 100 db records with the phone number in this format: 0000000000

I need to update the phone number format to: (000) 000-0000

Is there a quick way I could do this without changing each record manually? Is their a regular expression that could solve this problem?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

A simple update query and some string operations could solve your problem.

Ger all telephone numbers in a datatable and loop through the individual records.
Format all numbers using standard string operations like substring etc.

Update the table.

Just note that your phone number has to be of type varchar and not number.
If it is number, you will not be able to store formatted data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100