lilman Posted November 19, 2006 Share Posted November 19, 2006 I have an auto increment id set up for my table users. I want to reset it so it starts counting at 0. See, I register accounts and then dropped them but the auto increment doesn't start over. I hope I was clear enough, if not let me know. Is there a way to restart the counter? Link to comment https://forums.phpfreaks.com/topic/27802-resetting-counter/ Share on other sites More sharing options...
Conjurer Posted November 19, 2006 Share Posted November 19, 2006 Wow - that is exactly the same exact question I have.Call me annal retentive, but when I originally built the table I had a way to do it that set it to 1001 as the starting point. Because it is our member list I would like to have the new data load starting with 1001.It is an AR thing I know because from the functioning of the database it makes absolutely no difference. But it is something I want to do, so what would be the SQL statement to do it?I tried[quote]ALTER TABLE directory MODIFY user_id AUTO_INCREMENT = '1001'[/quote]But that bombs - I am trying to modify it in PHPAdmin. Link to comment https://forums.phpfreaks.com/topic/27802-resetting-counter/#findComment-127204 Share on other sites More sharing options...
printf Posted November 19, 2006 Share Posted November 19, 2006 You guys are missing point of what a auto increment column is used for, when you do silly stuff on a column that is setup with this option.printf Link to comment https://forums.phpfreaks.com/topic/27802-resetting-counter/#findComment-127209 Share on other sites More sharing options...
Conjurer Posted November 19, 2006 Share Posted November 19, 2006 Actually I acknowledged the point when I said I was being annal retentive and that where it starts makes no difference to the database, so that said, how do you do it?I know there is a way... Link to comment https://forums.phpfreaks.com/topic/27802-resetting-counter/#findComment-127214 Share on other sites More sharing options...
Conjurer Posted November 19, 2006 Share Posted November 19, 2006 Bingo!ALTER TABLE table_name AUTO_INCREMENT =1001 << or whatever value you want it to start with. :D Link to comment https://forums.phpfreaks.com/topic/27802-resetting-counter/#findComment-127222 Share on other sites More sharing options...
lilman Posted November 19, 2006 Author Share Posted November 19, 2006 [quote author=Conjurer link=topic=115580.msg470677#msg470677 date=1163975411]Bingo!ALTER TABLE table_name AUTO_INCREMENT =1001 << or whatever value you want it to start with. :D[/quote]Thank you! Link to comment https://forums.phpfreaks.com/topic/27802-resetting-counter/#findComment-127229 Share on other sites More sharing options...
fenway Posted November 20, 2006 Share Posted November 20, 2006 If you're cleaning out the table, use TRUNCATE -- otherwise, leave these alone. Link to comment https://forums.phpfreaks.com/topic/27802-resetting-counter/#findComment-127608 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.