Results 1 to 3 of 3

Thread: Why specify the char length in varchar?

  1. #1
    mdsawyer58 Guest

    Why specify the char length in varchar?


    Newbie question:

    Why bother specifing the length in varchar()?
    Why not just specify the max and not worry about truncation?

    Thanks,

    Martin


  2. #2
    mmwops Guest

    Why specify the char length in varchar? (reply)


    That's what varchar is all about. Just specify the max allowable number of chars and don't worry about actual size.

    ------------
    mdsawyer58 at 2/6/2002 11:19:07 AM


    Newbie question:

    Why bother specifing the length in varchar()?
    Why not just specify the max and not worry about truncation?

    Thanks,

    Martin


  3. #3
    mdsawyer58 Guest

    Why specify the char length in varchar? (reply)



    Guess I should have been more specific. Why not just
    specify varchar(255) for all strings vice saying, for example:
    first_name varchar(20), last_name varchar(30), etc...? This
    way if you enter a name that is longer than allowed it gets
    truncated, however, if you specify varchar(255) for all, the
    name gets preserved, unless it is longer than 255. I don't
    see any overhead associated with declaring everything
    varchar(255). I feel I must be missing the point. Or is this
    just one of those philosophical questions?

    Martin


    ------------
    mmwops at 2/7/2002 3:50:30 AM


    That's what varchar is all about. Just specify the max allowable number of chars and don't worry about actual size.

    ------------
    mdsawyer58 at 2/6/2002 11:19:07 AM


    Newbie question:

    Why bother specifing the length in varchar()?
    Why not just specify the max and not worry about truncation?

    Thanks,

    Martin


Posting Permissions

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