in reply to Question about phone number storage.

Worked on more than a few systems storing phone numbers. I've encounter char, varchar(2) and even pic x(n), but cannot recall having a phone number stored as an integer. In fact most of the storage methods have been so freeform (lazy coding?) as to have caused numerous datascrubs to excise or maybe make uniform the hodgepodge of ways people enter phone numbers. (argument for integer?)

lzcd makes great points about non numeric characters for area code and international numbers. I suggest that if you avoid integer, make sure you take measures to edit/format the numbers uniformly right up front.

and...imagine if someday we begin using HEX phones due to lack of numbers. an int won't handle a-f . maybe tell your boss that this could someday dwarf the Y2K problem ;-)

I wouldn't figure you'd draw any lines in the sand over this, if the boss is clamoring for an integer...

  • Comment on Re: Question about phone number storage.

Replies are listed 'Best First'.
Re: Re: Question about phone number storage.
by tye (Sage) on Jan 18, 2001 at 10:11 UTC

    I hate DBs that store phone numbers as (NNN)NNN-NNNN. What, you don't ever want any money from outside the United States?

            - tye (but my friends call me "Tye")
      I once had to deal with a DB (of my own creation, gone wild) that had three fields for the three parts of the NANP number. We wound up stuffing international into it by making the first field a varchar that allowed up to 8 or 9 digits, making the second field NULL allowed and making the last field a varchar that could hold up to 15 digits. Thus international numbers had a huge areacode and a huge local number and could be distinguished from NANP numbers by having a null NXX.

      I am still worried about buring in hell over that one. Of course we were able to get away with minor perl changes and didn't have to change one script at all. Still, I'm pretty sure I owe a few coders beer just for not complaining louder in the meeting when they decided to do it.

      --
      $you = new YOU;
      honk() if $you->love(perl)

      Why yes. Canadians are allowed to pay. But you can't ship anything to them, and will confuse them about the date they won't be be able to get things by.
Re: Re: Question about phone number storage.
by I0 (Priest) on Jan 18, 2001 at 20:53 UTC
    Actually, touch tones already are HEX, including *, #, and a fourth column of A, B, C, D