I have an invoices table which stores a single record for each invoice, with the id column (int AUTO_INCREMENT
) being the primary key, but also the invoice reference number.
Now, unfortunately I've had to manual migrate some invoices generated on an old system which have a five digit id, instead of a four digit one which the current system uses.
However, even when I reset the AUTO_INCREMENT
through PhpMyAdmin (Table Operations) back to the next four digit id, it still inserts a five digit one being the higher id currently in the table plus one.
From searching around, it would seem that I actually need to change the insert_id
as well as the AUTO_INCREMENT
? I've tried to execute ALTER TABLE invoices SET insert_id=8125
as well as ALTER TABLE invoices insert_id=8125
but neither of these commands seem to be valid.
Can anyone explain the correct way that I can reset the AUTO_INCREMENT
so that it will insert records with id's 8125
onwards, and then when it gets to 10962
it will skip over the four records I've manually added and continue sequential id's from 10966
onwards. If it won't skip over 10962
- 10966
then this doesn't really matter, as the company doesn't generate that many invoices each year so this will occur in a subsequent year hence not causing a problem hopefully.
I would really appreciate any help with this sticky situation I've found myself in! Many Thanks