Solved

mysql auto increment  help needed

Posted on 2011-03-06
3
550 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
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 142

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Creating and Managing Databases with phpMyAdmin in cPanel.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now