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

David Champion ciapug@cialug.org
Tue, 06 Apr 2004 10:59:17 -0500


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.
>
> 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.
>
> Lathrop


Ryan, take a look at this:

http://www.mysql.com/doc/en/Cast_Functions.html

-dc