mysql auto increment help needed

Hi

How to set a auto increment value starting like  00001 instead of 1 ?


Thanks
LVL 3
3xtr3m3dAsked:
Who is Participating?
 
geff_changConnect With a Mentor Commented:
The autoincrement value is a number (an integer).
So, leading 0s does not mean anything.

If you want to have leading 0s displayed in your client / program,
you need to manually format the data to be displayed with leading 0s.
It shouldn't be difficult to do.
0
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
I confirm the above statement, leading 0000 are formatting, not data.
0
 
Ovid BurkeConnect With a Mentor Consultant InstructorCommented:
You can specify zerofill:

ALTER TABLE `table_name`
MODIFY COLUMN `column_name`  int(10) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT FIRST ;

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.