Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
standard data types for ZIP CODES, PHONE NUMBERS, etc
Old 08-10-2006, 01:12 PM standard data types for ZIP CODES, PHONE NUMBERS, etc
Junior Talker

Posts: 1
Trades: 0
is there a link to some standard, universally accepted data types and sizes for common entries such as zip codes, phone numbers etc??? i am getting more involved in database work and i want to avoid problems with my data types... thanks in advance
leggo77 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-11-2006, 11:29 AM Re: standard data types for ZIP CODES, PHONE NUMBERS, etc
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
It depends what type of database you're using. ZIP and Phone numbers would usually be a text based field, such as VARCHAR in MSSQL.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 08-12-2006, 11:46 AM Re: standard data types for ZIP CODES, PHONE NUMBERS, etc
reli4nt's Avatar
Extreme Talker

Posts: 168
Location: New York
Trades: 0
It is largely a matter of personal preference since many options will produce the same results. Sometimes there are small reasons you may use to choose one over the other. For example, I generally use INTEGER for phone numbers keeping a separate fields for area code, exchange, and the last 4 numbers. I do this because it's easier to secure a integer input than it is to secure text. I also find is easier to search by area cosde or exchange in large databases this way.

In the end whatever works is fine, but simply let practice and individual circumstance be your guide.
__________________

Please login or register to view this content. Registration is FREE

Designing the world we live in.
Defining the terms we live by.
reli4nt is offline
Reply With Quote
View Public Profile Visit reli4nt's homepage!
 
Old 08-12-2006, 06:34 PM Re: standard data types for ZIP CODES, PHONE NUMBERS, etc
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Phone numbers should not be stored as integers. While it may work in most cases, phone numbers are not really 'numbers' as such - they are strings of numbers. For example, you wouldn't do a calculation on a phone number. Also, what if a phone number starts with a Zero? Store that in a database as an integer, and the database will drop the leading zero and when you retreive it, the phone number will be wrong.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 08-13-2006, 01:29 AM Re: standard data types for ZIP CODES, PHONE NUMBERS, etc
reli4nt's Avatar
Extreme Talker

Posts: 168
Location: New York
Trades: 0
good point regarding the leading zeros.
__________________

Please login or register to view this content. Registration is FREE

Designing the world we live in.
Defining the terms we live by.
reli4nt is offline
Reply With Quote
View Public Profile Visit reli4nt's homepage!
 
Reply     « Reply to standard data types for ZIP CODES, PHONE NUMBERS, etc
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14684 seconds with 12 queries