tags:

views:

124

answers:

2

I am using MySQL 5. I need to set the seed value as 1000 for my auto increment field. How can I set it?

+2  A: 

If the table already exists, you can do this:

alter table mytable auto_increment=1000;

But make sure the highest value in the auto_increment column is less than 1000.

If you are creating a new table, you can do this:

create table mytable (id int unsigned primary key auto_increment) auto_increment=1000;
Asaph
+1  A: 

To set when creating your table:

CREATE TABLE xxx(...) AUTO_INCREMENT = 1000;

To set after creating the table:

ALTER TABLE xxx AUTO_INCREMENT = 1000;
Julien Lebosquain