I am making an SQL database that stores contacts. I want to be able to delete contacts, and the correct id for each contact is crucial for my software connecting to it. Lets
I wrote an application to handle a multi-level sales program. Of course, people drop out. In ours, people had to be inserted as well.
You're on the right track with one modification.
The identity number (ID) and the sequence number (seq) are two different things. They have no relationship with each other at all.
Never change an ID. Once assigned, always assigned.
Create a column (cNEXT) in your table for the sequence and populate it with IDs. "What ID is to be the next one in this sequence?"
Shuffle the IDs in cNEXT around, reassigning cNEXT, any time you want. Any stored proc can do that.
Then you also have the flexibility to create non-sequential chains of IDs. This is useful when people move to different regions or get promotions to different groups.
Hope this helps! :)