[ciapug] MySQL table data - "1" and "01" different values

Ryan O'Rourke ciapug@cialug.org
06 Apr 2004 11:02:27 -0500


On Tue, 2004-04-06 at 10:49, Lathrop Preston wrote:
> > I had been using SMALLINT but it drops leading zeros as well.
> 
> any numeric type
> SMALLINT
> INT
> FLOAT
> etc.
> will drop leading zeros, this has nothing to do with it being mySQL, if 
> you use a numeric type in _any_ DB or language you will not have leading 
> zeros.

dagnabbit.

> if you are dealing with car numbers
> is is a static length value ie ( all numbers will be 5 characters long?)
> 
> if so str_pad() will still work.

The numbers range from one to three characters. With "01" and "02"
causing the problems. The lowest numbered car being 0 and the highest
numbered car being 280.