[ic] Increment integer with preceding zeros

JT Justman jt at endpoint.com
Sat Apr 5 21:58:19 CDT 2008

Grant wrote:
> Is there a way to increment an integer like 000001 to end up with
> 000002?  The integer is stored in a MySQL table.

Not sure if MySQL has a function for this. Using auto increment is 
better if this is an index.

In Perl you can use sprintf:

sprintf("%06d", $i);

Where 6 is the desired width.

JT Justman
End Point Corporation

More information about the interchange-users mailing list