[ciapug] MySQL table data - "1" and "01" different values
Dave J. Hala Jr.
ciapug@cialug.org
06 Apr 2004 11:22:48 -0500
An alternative might be to just leave the car numbers as a character
field and add a second int field. When doing an insert convert the car
number to the int field and save it in the second field. When selecting
records, just order by the second field.
Kinda messy. But it would work.
:) Dave
On Tue, 2004-04-06 at 11:02, Ryan O'Rourke wrote:
> 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.
>
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug
--
"...Unix, MS-DOS and Windows NT (also known as the Good, the Bad, and the Ugly)"
OSIS
Dave J. Hala Jr.
641.485.1606