Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unique Key Violation
Message
 
To
24/07/1999 16:25:06
Antonio Gubaira
Ingenieria Y Sistemas
Valencia, Venezuela
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00245748
Message ID:
00245755
Views:
18
>That means that every time I delete a record a PACK must follow? Why is SET DELETED ON not hiding the duplicate key ?

A primary (or cnadidate) index requires unique key values. The fact that DELETED is ON does not change the fact that the key exists. If VFP allowed you to add a duplicate key, then you would have a problem if DELETED was turned off.

You can use a surrogate primary key as a one solution. Since you always assign a new key when adding a record, you don't get uniqueness violations.

Another way to handle the problem is to keep DELETED OFF. If you are displaying a deleted record, disable the ability to edit it and give the user an obvious indication of its deleted status. If the user tries to add a key that has been deleted, let them know that a deleted record already exists and give them the option to undelete the record.

You can also change the key value before deleteing a record. FOr example a numeric key could be made negative when the record is deleted.

The index could be made a composite key that includes the deleted status as part of the key.
Steve Ruhl
CitiMortgage, Inc.
steven.ruhl@citibank.com Office
Steve@steven-ruhl.com Home
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform