What datatype should be used for storing phone numbers in SQL Server 2005?

前端 未结 16 2066
情话喂你
情话喂你 2020-11-28 05:29

I need to store phone numbers in a table. Please suggest which datatype should I use? Wait. Please read on before you hit reply..

This field needs

16条回答
  •  醉话见心
    2020-11-28 05:47

    using varchar is pretty inefficient. use the money type and create a user declared type "phonenumber" out of it, and create a rule to only allow positive numbers.

    if you declare it as (19,4) you can even store a 4 digit extension and be big enough for international numbers, and only takes 9 bytes of storage. Also, indexes are speedy.

提交回复
热议问题