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

前端 未结 16 1960
情话喂你
情话喂你 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:49

    It is always better to have separate tables for multi valued attributes like phone number.

    As you have no control on source data so, you can parse the data from XML file and convert it into the proper format so that there will not be any issue with formats of a particular country and store it in a separate table so that indexing and retrieval both will be efficient.

    Thank you.

    0 讨论(0)
  • 2020-11-28 05:52

    SQL Server 2005 is pretty well optimized for substring queries for text in indexed varchar fields. For 2005 they introduced new statistics to the string summary for index fields. This helps significantly with full text searching.

    0 讨论(0)
  • 2020-11-28 05:52

    Use data type long instead.. dont use int because it only allows whole numbers between -32,768 and 32,767 but if you use long data type you can insert numbers between -2,147,483,648 and 2,147,483,647.

    0 讨论(0)
  • 2020-11-28 05:54

    Use a varchar field with a length restriction.

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