Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 416
  • Last Modified:

Renumbering Primary key after delete

Is it possible to renumber the primary key after deleting records so that the primary key field doesn't have missing numbers?
0
BoB
Asked:
BoB
1 Solution
 
aburrCommented:
It cannot be done easily. You can fill in the gaps when you enter new records though. You could also make some new tables with Make Table querries and shift the primary key to a serial numbered field.
0
 
chapieCommented:
from what I understand supposedly it will start at the lowest possible number for you when you repair/compact, but I haven't seen that myself (have tried, but didn't pay a whole lot of attention to it)

you could change the attributes of the autonumber, from incremental to random (which also doubles the possible ranges because it will now include negatives).

Or you can setup your own type of autonuber procedure provided you only use the data tables via a form, and not directly accessing / adding records via table or query
0
 
martiCommented:
If your Primary Key is long integer I can send you a sample. Please contact me at konst@sprint.ca
0
 
aburrCommented:
The primary key does not have to be autonumber. If it is, the best way is to use a make table querry and get the records renumbered.
0
 
devthaCommented:
Hi,
I am experiencing the same type of problem.
What I understand is you have to reindex the table.
When I add a record to the table it goes in fine..
When I retrieve that same record base on the different criteria I can see that record. When I retrieve the same record base upon the Primary Key it does not show up and gives me my custom message that value not found in the table.
So I assume you have to reindex it in either case.. But how do you do that?
Devtha
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now