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? Link to comment https://forums.phpfreaks.com/topic/109612-reset-auto_increment-table/ 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 ) Link to comment https://forums.phpfreaks.com/topic/109612-reset-auto_increment-table/#findComment-562271 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. Link to comment https://forums.phpfreaks.com/topic/109612-reset-auto_increment-table/#findComment-563043 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.