Jump to content

Archived

This topic is now archived and is closed to further replies.

pootlecat

Update auto_increment Column

Recommended Posts

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!

Share this post


Link to post
Share on other sites
ALTER TABLE yourTABLE AUTO_INCREMENT = N

Share this post


Link to post
Share on other sites
I don't know what you mean by that... it won't update anything.  But it will reset the internal table counter.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.