• harri.reddy (8/29/2012)


    hi

    i need to craete table which has phone number field,

    format (345) 234 - 2345

    what is the best data type i can use,int,varchar.

    plz suggest me

    I have to chime in with several of the others. Don't store formatted telephone numbers in the database. Do the formatting in the front end if you have one.

    A better thing to do would be to break the phone number up into pieces for Area Code, Exchange, and Line Number. Of course, international numbers will require country code (1-3 digits), city code (0 to 4 digits), and line number (1 to 6 digits, IIRC). Well, except for Mexico which uses country code, band, and some other stuff.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)