用于MSISDN存储的最佳数据类型和长度

[英]Best Data Type and length to use for MSISDN storage


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

用于存储MSISDN(电话号码)的最佳数据类型是什么?

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

需要能够在世界上存储任何电话号码。

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

有没有人知道MSISDN网络的最大长度,包括国际拨号代码?

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

例如,南非的电话号码是+27xxxxxxx,结果是11位数字,不包括+

The + does not have to be stored.

+不需要存储。

Thanks in advance

谢谢提前

2 个解决方案

#1


10  

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

我使用BIGINT。请尽量避免使用varchar。使用varchar或char是个非常糟糕的主意。

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

的原因。Varchar/char占用的空间更大,查找和交叉引用的速度更慢,索引也更大。

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.

当设计表时,尝试使用设置的行长度来保持它们,事情就会运行得更快。如果您需要一些文本字段,最好使用char而不是varchar,因为varchar的开销很高。

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.

我在电信行业工作了12年,现在设计/优化VoIP/SMS平台。当我来修系统的时候,最大的杀手就是到处都是varchars。

Just my 0.02 worth.

只是我的0.02的价值。

#2


3  

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

MSISDN限制为15位,不包括前缀。

MSISDN in the GSM variant is built up as:

GSM变体中的MSISDN构建为:

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.

最长的国际拨号代码只在打电话时使用,它是882 16。你可以把它保存在其他地方。

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

如果您打算将国际拨号代码与MSISDN结合使用,您可以使用nvarchar(21)或varchar(21)。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2012/06/21/7dd5966fea6eacdd001952c692bb39b2.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号