Professional Web Applications Themes

What data type is used for phone numbers?? - Microsoft SQL / MS SQL Server

On Sat, 2 Aug 2003 23:53:34 -0700, "westside" <com> wrote:   Unless you are handling the specific formatting of international phone numbers, mobile (cell) phones, etc. I would strongly advise giving *any* numeric data type a miss for phone numbers. I typically use varchar(15) which seems to cope with all that I've encountered so far. Perhaps though, you could tell us what types of phone numbers you want to store? e.g. if you just want to store numbers local to your country, and not including "special" numbers that can drive auto-dial applications (e.g. including characters to tell the dialler to ...

  1. #1

    Default Re: What data type is used for phone numbers??

    On Sat, 2 Aug 2003 23:53:34 -0700, "westside" <com>
    wrote:
     

    Unless you are handling the specific formatting of international phone
    numbers, mobile (cell) phones, etc. I would strongly advise giving *any*
    numeric data type a miss for phone numbers. I typically use varchar(15)
    which seems to cope with all that I've encountered so far.

    Perhaps though, you could tell us what types of phone numbers you want
    to store? e.g. if you just want to store numbers local to your country,
    and not including "special" numbers that can drive auto-dial
    applications (e.g. including characters to tell the dialler to pause,
    etc) then *maybe* you could get away with a numeric data type. But I'd
    still advise against it.
     

    I use varchar. Generally I use varchar(60). I've seen some addresses
    that are longer, but not (yet) for my clients.

    cheers,
    Ross.
    --
    Ross McKay, WebAware Pty Ltd
    "Since when were you so generously inarticulate?" - Elvis Costello

    Ross Guest

  2. #2

    Default Re: What data type is used for phone numbers??

    Westside,

    "westside" <com> wrote in message news:03e101c3598b$f52d9fc0$gbl... 

    Short answer = whatever works.

    Do you have international or area codes to consider?
    Do you want to store '(', ')', '-', ',', and spaces ?
    Do you want to do validation against, say valid country / area codes ?
    Do you want to store country, area, phone number in one column or several ?
    Do you need to be able to programmatically dial from the codes ?

    My preference has been multiple int/bigint columns, as it makes the above easier,
    but I know nothing of your application.
     

    Yes, but you can use the domain name rules to add sensible constraints ( such as must have one '' )
    E.g. http://www.101domain.com/rules.htm

     

    Regards
    AJ

    p.s. If you are a junk mailer or tele-marketer please direct all responses to org


    Andrew Guest

  3. #3

    Default Re: What data type is used for phone numbers??

    If you are not going to do calculations with it, then don't store it in
    a numeric data type. Since you are never going to calculate with a phone
    number I would suggest using varchar. If you want to support
    international numbers, use varchar(21).

    (storing it in varchar also makes it easier to support phone numbers
    like 0800-carglass)

    Hope this helps,
    Gert-Jan


    westside wrote: 
    Gert-Jan Guest

  4. #4

    Default Re: What data type is used for phone numbers??

    Hi,

    Thanks for the reply.

    No, I am not doing any calculations on the numbers..

    I would like to be able to support international numbers, 1-800,
    1-800-THE-NEWS (numbers like this)

    Also, auto-dial applications are something we would like to do.. At this
    point I have not found a good source, but I am looking for an auto-dial
    application, that can make a call through the web, based on a user event
    on our website. Lik if a user does "x", then dial this number and then
    do this... etc, etc...

    I would like to store my phone numbers with the dash for readability...
    like 703-555-1212 or 1-877-555-1212, stuff like this is a must for us.

    I have setup the database to hold the numbers in multiple columns. We
    have a column in our database for Area Code, Phone Number, Extension. I
    guess the Area Code column could also hold country codes as well, I am
    not too on the up and up on international phone numbers and their
    length/formats, but we would like to suppor them..

    So based on the above, is Varchar the best choice?

    -WestSide

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    West Guest

Similar Threads

  1. converting phone numbers to alphabets
    By fo in forum PERL Modules
    Replies: 2
    Last Post: July 12th, 06:27 AM
  2. Replies: 2
    Last Post: February 16th, 07:05 PM
  3. [PHP] MySQL field data type for ISBN numbers
    By Michael Geier in forum PHP Development
    Replies: 0
    Last Post: August 11th, 12:53 AM
  4. Choose From 3 Phone Numbers IF Statement
    By Rick in forum Microsoft Access
    Replies: 3
    Last Post: August 5th, 01:52 AM
  5. ppp script for multiple phone numbers
    By Frank Hahn in forum Sun Solaris
    Replies: 0
    Last Post: July 5th, 05:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139