Jump to content

[SOLVED] Primary id sequential


ksb24930

Recommended Posts

well, you would probably have to do a query, get all the id's from the table, and process the information to find any gaps. once you do that, you can just set any new ids as in between those gaps, but that would kind of defeat the purpose of auto-increment because you wouldn't even really be using its functionality if you did that. Can I ask why you need there to be no gaps?

 

 

Edit: There may also be some fancy SQL commands you could do, but i'm not sure about that

Link to comment
Share on other sites

resetting the primary key, or filling in gaps, ruins the referential integrity of the database. the whole reason that gap is there is because there once was an entry, and is no more - that points to the fact that any other records using that key in their entry are orphaned. it's important to know these things, and if it isn't, then having that key is a little pointless in the first place.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.