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 )

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.