Jump to content

Reset Auto_Increment Value


ainoy31

Recommended Posts

Hello-

 

I want to know if it is safe to run the following script to reset my auto increment value in my table without messing up the current records?

 

ALTER TABLE carriers_schedule AUTO_INCREMENT = 1

 

I have a script that automatically delete records if it is older than today when an upload occurs.  Right now I have up to 9756 records but an estimated 1 - 2545 records already have been deleted.  I want the to count to start over at 1 after it reaches say 1200.  Much appreciation 

 

Link to comment
Share on other sites

Well, since that script only sets the ID for the upcoming records, the current records stay untouched. The only harm in this could be ID duplication, when a daily upload runs over 1200, but i suppose you're aware of that.

 

Agreed... don't reset IDs, unless you blow away all of the data in the table, in which case use TRUNCATE, not DELETE.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.