Newbie question:
Why bother specifing the length in varchar()?
Why not just specify the max and not worry about truncation?
Thanks,
Martin
Printable View
Newbie question:
Why bother specifing the length in varchar()?
Why not just specify the max and not worry about truncation?
Thanks,
Martin
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
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