BrianM Posted June 10, 2008 Share Posted June 10, 2008 Is there a way to reset an auto_increment table without having to rebuild and apply a new structure? Quote Link to comment Share on other sites More sharing options...
kbh43dz_u Posted June 10, 2008 Share Posted June 10, 2008 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 ) Quote Link to comment Share on other sites More sharing options...
fenway Posted June 11, 2008 Share Posted June 11, 2008 Is there a way to reset an auto_increment table without having to rebuild and apply a new structure? I don't think you want to. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.