pootlecat Posted October 9, 2006 Share Posted October 9, 2006 I have a table where the auto_increment column starts at 1237333 and I want to change it so that it starts at 1 instead. Is there an easy way to do this at all?Thanks for any help you can give me! Quote Link to comment Share on other sites More sharing options...
fenway Posted October 10, 2006 Share Posted October 10, 2006 ALTER TABLE yourTABLE AUTO_INCREMENT = N Quote Link to comment Share on other sites More sharing options...
pootlecat Posted October 10, 2006 Author Share Posted October 10, 2006 I just noticed your reply to me - thanks!So doign this command will update every row in the table? Quote Link to comment Share on other sites More sharing options...
fenway Posted October 10, 2006 Share Posted October 10, 2006 I don't know what you mean by that... it won't update anything. But it will reset the internal table counter. Quote Link to comment Share on other sites More sharing options...
pootlecat Posted October 10, 2006 Author Share Posted October 10, 2006 The problem I have is that I split one massive table into 3 smaller ones and I want the auto_increment column to start from '1' on 'line 1' and increase from there on all 3 tables. I was just hoping there would be some simple command I could do that would recalculate all the auto_increment values for me. Quote Link to comment Share on other sites More sharing options...
fenway Posted October 10, 2006 Share Posted October 10, 2006 You don't want to do any of this... leave these values alone. In theory you can just "recalculate" them yourself, and use whatever values you deem appropriate (but unless you can really convince me, I'm not going to tell you how). Since it sounds like you're just starting out, I'm assuming that nothing is referencing these records via a FK. The least bad method would be simply to copy the records over to a fresh table without their UID, and let MySQL take care of it. 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.