skipped value with auto increment
Posted: Tue Oct 05, 2004 1:53 pm
Hi, all. I'm sorry if this has already been asked but I couldn't find anything on it.
Small problem; not really a problem, actually, just annoying. It goes like this:
My primary key is set to not null auto_increment and each record is assigned a value consecutively greater than the last by one... except, that is, if I have deleted my last record. Then it skips the value that the deleted record used to have... and the primary key value of the deleted record is never used again. Why is this? Is there any way to have it automatically put the newest record in empty slots? Would I have to runa aloop that searches for any empty PK values and inserts the new record there?
Thanks.
Small problem; not really a problem, actually, just annoying. It goes like this:
My primary key is set to not null auto_increment and each record is assigned a value consecutively greater than the last by one... except, that is, if I have deleted my last record. Then it skips the value that the deleted record used to have... and the primary key value of the deleted record is never used again. Why is this? Is there any way to have it automatically put the newest record in empty slots? Would I have to runa aloop that searches for any empty PK values and inserts the new record there?
Thanks.