Jump to content

Reset auto_increment table


BrianM

Recommended Posts

Try

ALTER TABLE tablename AUTO_INCREMENT = 1

It should set auto increment to the number of your last entry + 1. (Setting it to 0 when you have entries will not work ;) )

I hope I could help you.

 

 

edit: if you want to add an entry with an auto increment number which you deleted before you can use:

SET insert_id = 8;
INSERT INTO tablename VALUES (’field1’, '…');

(for example if you have entries from 0 to 10 but deleted entry number 8 )

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.