How do you store cell phone numbers in a database?

前端 未结 3 720
无人共我
无人共我 2021-01-07 18:36

With the age of text messages and things like that, what\'s a good way to store phone numbers in a database?

In the USA, text messages are handled by phone numbers b

相关标签:
3条回答
  • 2021-01-07 19:19

    I don't know if you have read these two questions, but they might help you a little.

    • Phone Number Columns in a Database
    • Is there a standard for storing normalized phone numbers in a database?

    Perhaps it would be wise to store the type of number (landline, cell, fax) and/or the messages that can be received on it (voice, text, email). Note that in the US, it is also possible to send text messages to a phone via email, but I believe that is dependent on the carrier.

    0 讨论(0)
  • 2021-01-07 19:20

    Generally as text, you don't need all the fancy formatting, unless you need it to parse numbers from different countries that you can't distinguish otherwise. You can always add the formatting later on.

    Not as a number!!! Leading zeros may be problematic.

    0 讨论(0)
  • 2021-01-07 19:22

    I would primarily use a text field, or a series of text fields, even if you are using a numerical phone number for the following reasons.

    1. Phone numbers have a great range of values, including extension numbers which may result in numerical columns losing precision.
    2. Losing precision in a phone number is rather bad.
    3. There is no logical reason to want to perform math ( addition/multiplication ) on a phone number.

    Additionally, you may want to specify how you are using this data. If you are planning an automated messaging service, you're going to need a series of relaying agents to broadcast via, so you may as well add an identifier that pertains to the relay the information pertains to. Then all you have to worry about is that the relaying agent can understand the content in the text fields.

    0 讨论(0)
提交回复
热议问题