Hi is it possible to have an auto_increment integer which increases like this
0001
0002
0003
etc rather than 1, 2, 3?
I cant get mysql to recognise the zeros, but need to input job numbers automatically and they need the zeros
cheers
gray
| SitePoint Sponsor |
Hi is it possible to have an auto_increment integer which increases like this
0001
0002
0003
etc rather than 1, 2, 3?
I cant get mysql to recognise the zeros, but need to input job numbers automatically and they need the zeros
cheers
gray


why are you inputting auto_increment numbers?
just display them with leading zeroes whenever you select them
i remember once testing the ZEROFILL attribute, which is exactly what you need here, but couldn't get it to work
therefore, i did it myself:
select right(concat('00000',id),4) as zerofilled_id ...




I prefer not to mess with the auto_increment counter at all, not at the databases side, but you can format it when displaying like r937 has shown.
SK
cool thanks guys
Bookmarks