phone number should be a string or some numeric type that have capacity to save phone number?

Sahil Sharma picture Sahil Sharma · Feb 15, 2017 · Viewed 23k times · Source

We want to store 10 digit mobile number i.e.9999999999. Should it be numeric or string datatype? We don't want to do any calculative or manipulation operation on this

Which is better memory and performance wise?

Answer

O. Jones picture O. Jones · Feb 15, 2017

ITU-T recommendation E.164 says you need 3 digits for the country code and up to 15 digits for the directory number within the country dialing plan.

And, many people add some punctuation. For example:

+1.212.555.1212 is a North American number. It could also be rendered (212) 555-1212 in a North American centric app.

32 characters of text should do the trick worldwide.

DO NOT use a number, or you'll be sorry. I was: two things.

  • Lost some European business for a company because we assumed all phone numbers were NANP-compliant ten-digit numbers.
  • A spreadsheet export rendered the numbers in scientific notation 2.12555E+09 That's almost as stupid as SIRI telling me you have call from two bllion, one hundred twenty five million....

Telephone directory numbers are not numeric data types. Take a look at this: Falsehoods Programmers Believe About Telephone Numbers.