Reply to topic
Phone Numbers in a Database
jamie
HostMySite Sales Rep
HostMySite Sales Rep

Joined: 19 Mar 2004
Posts: 858
Location: Newark, De
Reply with quote
what's the best variable type to use when storing a phone number in a database?
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1047
Location: Felton, Delaware
Reply with quote
varchar

Even though for a phone number you primarily use integers, there is any array of other characters that can be used such as (, ), [, ], -, and +. Therefore what you're storing is a string. What better datatype to use than a string Wink varchar. Now, you could use char, but that entales padding... not a problem if you practice good coding habits and TRIM everything all the time anyway. And anything like a memo/text field is OVERKILL... and with MSSQL there are even datatypes such as nvarchar... again, overkill. varchar is usually sufficient.
Phone Numbers in a Database
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic