Jump to content

resetting the auto_increment count


MinusMyThoughts

Recommended Posts

i don't know if this actually matters at all in coding a page, but when i was testing my database, i submitted a handful of entries into the database, which i've since deleted. however, the auto_increment value is still sitting where it was when all those values were in the database......first question: will this cause problems if i try to run a while command and it searches "1" and can't find it?...second question: how hard is it to reset the auto_increment to "0"?...thanks!love,jason

Link to comment
Share on other sites

Since auto-increment values are always generated automatically (unless you specify), you typically don't search for hard-coded values. If you want to use a specific value for a special case or something, just insert a row and specify the ID. Or, update an existing row and specify the ID. But there won't be any problems if there are 'missing' rows in the table, like if the first ID is 12 or something. If you try searching for a row that doesn't exist, you will just have an empty result set.If you want to change the autoincrement value, you can use a statement like this:ALTER TABLE tbl AUTO_INCREMENT = 100;

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...