Formatting phone numbers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • angelards
    New Member
    • Sep 2008
    • 1

    Formatting phone numbers

    I have a phone Field where records vary with how they were entered with punctuations: examples:

    2485551212
    248.555.1212
    248-555-1212
    248 555 1212

    along with a few others. I am looking for a script to write them all to the same format. preferable 248-555-1212 or no punctuation at all.

    I'm not sure if I should do a replace script to remove the unwanted characters or if there is something that will delete all non numeric characters from the field and then do an input mask?
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Try:

    Code:
    select replace(replace(replace(phone_number, '-',''),'.',''),' ','') from yourtable
    -- CK

    Comment

    Working...