Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary key
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00433795
Message ID:
00433800
Views:
16
>i have problem with table with a primary key. for expample I delete a registry and then I try to add a new registry with the same value VFP give me an error that the registry exist.
>how can i resolve this?.

The primay key index includes deleted records until you pack. One solution is to create your primary key index with a FOR !DELETED(). This will not be optimizable, so create a non-primary index on the primary key as well.

But the better option is to not re-use a primary key. If your primary key is a surrogate (not having any meaning except a unique identifier of the record), then there's no reason to ever re-use it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform