Jump to content

How to choose initial value for auto incrementing field


mpsn

Recommended Posts

Hi, I"m trying to create a simple online buying site and I have a unique ID as well as a unique IMEI (it is the identification number used on cellular phones) that I want also to be unique but I want to choose the starting value to be some big number like 1000000000000000 (16 digit value), I think this is a simple question, I'm using phpmyadmin if that helps btw.  :rtfm:

I was trying to go for more authenticity since actual cellular phones have this IMEI (ID number) being that long, but I can go shorter if  that's the case, just let me know how, thanks.

The number is depends on what YOU want.  What is this for?  If this is just a unique identifier then use an auto-incremented field and start at 1.

So not possible to have this auto incrementing digit start at a number I want?

It is possible.  Read the manual - http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html

 

To start with an AUTO_INCREMENT value other than 1, you can set that value with CREATE TABLE or ALTER TABLE, like this:

 

mysql> ALTER TABLE tbl AUTO_INCREMENT = 100;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.