PDA

View Full Version : SQL Don't reuse previously deleted auto_increments?



Icy Penguin
January 8th, 2009, 04:27 PM
I was looking at my tables today and found that some row IDs have the same ID as some rows that I deleted earlier in the day.

So, if I have rows with IDs 1,2,3,4, and 5, and then delete the row with ID 3, I'll have 1,2,4,5 of course. But inserting another row then reuses that 3, instead of starting with 6. Is there a way to reverse this?

simplistik
January 8th, 2009, 08:08 PM
Ummm ... is id your primary key and is it set to auto increment? If it is, it shouldn't be replacing an already deleted key, it should auto increment properly.

Icy Penguin
January 11th, 2009, 05:14 AM
http://i512.photobucket.com/albums/t321/sheldonnbbaker/screen-capture.png
:/ 'id' has auto_increment and is set as a primary key - my sql INSERT statements don't specify any id to be inserted - only the other fields.