Solved

mysql auto increment  help needed

Posted on 2011-03-06
3
565 Views
Last Modified: 2012-05-11
Hi

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


Thanks
0
Comment
Question by:3xtr3m3d
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
geff_chang earned 167 total points
ID: 35046178
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
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 167 total points
ID: 35046200
I confirm the above statement, leading 0000 are formatting, not data.
0
 
LVL 11

Assisted Solution

by:Ovid Burke
Ovid Burke earned 166 total points
ID: 35046219
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question