MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 24 1999 11:45am
Subject:Re: Question: How to keep leading zero's
View as plain text  
>Hey there,
>how would I keep a leading zero? If I fill an int(5) with 03025 it'll
>truncate? (or is that just for behind the comma?) the 0 off. Since I wanna
>use this as primary key and it is to indicate or article numbers, which
>are always 5 numbers, I'd like to keep the 0 in although it's

Perhaps INT(5) ZEROFILL would do what you want.  Either that, or store
the number as a string.  Normally strings sort differently than numbers,
but in your case, since you always have the leading zeros, they would
sort in the same order.

A string wouldn't be as efficient, though.

Paul DuBois, paul@stripped
Northern League Chronicles:
Question: How to keep leading zero'sTechnische Dienst24 Jun
  • Re: Question: How to keep leading zero'sPaul DuBois24 Jun
RE: Question: How to keep leading zero'sSid Young25 Jun