vinoindiamca Posted February 6, 2009 Share Posted February 6, 2009 Hi, I had a doubt in reseeding deleted values For example if records stored like S.No Name Contact 1 aaa 5656656 2 bbb 5656656 3 ccc 5656656 4 ddd 5656656 if i used to delete one record of second record it looks S.No Name Contact 1 aaa 5656656 3 ccc 5656656 4 ddd 5656656 i need the result to be reseed values like 1 aaa 5656656 2 ccc 5656656 3 ddd 5656656 Please help in this Quote Link to comment https://forums.phpfreaks.com/topic/144065-how-to-reseed-deleted-records/ Share on other sites More sharing options...
shlumph Posted February 6, 2009 Share Posted February 6, 2009 Why would you want to do this? Many novices wish to do this, but they don't need to. Quote Link to comment https://forums.phpfreaks.com/topic/144065-how-to-reseed-deleted-records/#findComment-755924 Share on other sites More sharing options...
omfgthezerg Posted February 6, 2009 Share Posted February 6, 2009 UPDATE TABLE `table` SET AUTO_INCREMENT = 3 Quote Link to comment https://forums.phpfreaks.com/topic/144065-how-to-reseed-deleted-records/#findComment-755953 Share on other sites More sharing options...
aschk Posted February 6, 2009 Share Posted February 6, 2009 I believe omfgthezerg's solution may be wrong, as you do NOT want to set the auto_increment back to 3. This will cause key conflicts on keys that exist that are higher than this value. As shlumph posted "why do you want to do this?". You probably don't need to. Quote Link to comment https://forums.phpfreaks.com/topic/144065-how-to-reseed-deleted-records/#findComment-755966 Share on other sites More sharing options...
shlumph Posted February 6, 2009 Share Posted February 6, 2009 As shlumph posted "why do you want to do this?". You probably don't need to. Especially if your database grows. What if you want to link this table to other tables? You'll have to update all those tables too! Is there a specific reason why you want no gaps in numbers? We can probably find a better solution... Quote Link to comment https://forums.phpfreaks.com/topic/144065-how-to-reseed-deleted-records/#findComment-756084 Share on other sites More sharing options...
JonnoTheDev Posted February 6, 2009 Share Posted February 6, 2009 There is no reason for you to do this. Quote Link to comment https://forums.phpfreaks.com/topic/144065-how-to-reseed-deleted-records/#findComment-756087 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.