MySQL Forums
Forum List  »  General

Inserting into empty rows in Table with Auto-Increment
Posted by: Bryon Sol
Date: December 14, 2010 08:03AM

Hello,

I tried to find the answer to this and believe that the answer is no, but I wasn't certain so I'll ask more directly.

If I have a table with an auto-increment column, can I insert records into empty rows without disturbing the normal auto-increment functionality?

For instance a table like this:
Index FirstName LastName
1 John Smith
2 Jane Doe
4 Oscar Wilde
5 James Dean

Notice that a) the next available index would be 6 and that b) there is an empty row at Index=3.

I have a database without referential integrity and periodically users delete rows accidentally. What I would like to do is be able to re-insert the data into the original row where it came from as this is simpler than fixing the references.

Can I simply do an insert into the table at Index=3?

I do not believe that this is possible, but I thought I would ask.

Options: ReplyQuote


Subject
Written By
Posted
Inserting into empty rows in Table with Auto-Increment
December 14, 2010 08:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.