Best Data Type and length to use for MSISDN storage
Asked Answered
S

2

7

What would be the best Data Type to use for storing an MSISDN (phone number).

Need to be able to store any phone number in the world.

Does anyone know the maximum possible MSISDN length, including international dialling code?

For example South Africa phone numbers are +27xxxxxxxxx which results in 11 digits excluding the +

The + does not have to be stored.

Thanks in advance

Southwestward answered 21/6, 2012 at 7:52 Comment(0)
P
13

I'd use BIGINT. Please avoid using varchar at all costs. It's a very bad idea to use varchar or char.

Reasons. Varchar/char takes up more space, it's slower to do lookups and cross references and the index is larger too.

When designing tables try and keep them with set row lengths, things will run loads faster. If you have to have some text field it is often best to use char instead of varchar as the overhead cost of varchar is high.

Am working in telecoms for 12 years now designing/optimizing VoIP/SMS platforms. The number one killer when I come in to fix systems is varchars everywhere.

Just my 0.02 worth.

Prescription answered 11/7, 2012 at 12:20 Comment(0)
T
3

A MSISDN is limited to 15 digits, prefixes not included.

MSISDN in the GSM variant is built up as:

MSISDN = CC + NDC (or NPA ) + SN
CC = Country Code
NDC = National Destination Code
NPA = Number Planning Area
SN = Subscriber Number

You ideally do not have to save the +. It simply represents an exit.

The longest international dialling code would only be used when making calls with a Thuraya, which is 882 16. You can have that saved else where.

If you are planning to combine the International dialling code and MSISDN, you can use a nvarchar(21) or varchar(21).

Towland answered 10/7, 2012 at 16:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.