Best way to store a cell phone number in SQL database

Last post 10-27-2008 12:29 PM by Naom. 1 replies.

Sort Posts:

  • Best way to store a cell phone number in SQL database

    10-27-2008, 11:48 AM
    • Member
      16 point Member
    • mentat
    • Member since 12-12-2005, 8:34 PM
    • Posts 20

    Hi there,

    I have  a requirement when a user signs up to capture their mobile/cell phone number. Then later I send them sms (txt) messages for various actions on my site.

    I am using clickatell to send the text message and it is working well. To send the message the phone number needs to be in full international format no + or leading zeros so for US like 12223334444 that is how I will store it in the database and how it needs to be to send an sms message.

    To capture the text message I use a Masked textbox like http://www.asp.net/AJAX/AjaxControlToolkit/Samples/MaskedEdit/MaskedEdit.aspxwith Mask format +1 999-999-9999 then I strip out any non-numberic values and store as a varchar in the database. Is this the best way to do this?

    Also later down the track I might need to handle other countries.

     Thanks

  • Re: Best way to store a cell phone number in SQL database

    10-27-2008, 12:29 PM
    Answer
    • All-Star
      31,129 point All-Star
    • Naom
    • Member since 12-31-2007, 2:08 PM
    • Wisconsin
    • Posts 6,888

    Check CHRTRAN function by Igor Nikiforov at http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50044 to do your replacement.

    Looking for a job opportunity.

    Beware of bugs in the above code; I have only proved it correct, not tried it.
    (Donald Knuth)

    Visit my blog

    PluralSight Learning Library
Page 1 of 1 (2 items)