Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem adding record with same deleted Primary Key valu
Message
From
22/10/1997 10:48:06
Larry Long
ProgRes (Programming Resources)
Georgia, United States
 
 
To
20/10/1997 11:39:35
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00055190
Message ID:
00056034
Views:
32
>>>>>>Hello,
>>>>>>
>>>>>>I worked on a table which has a primary index called "Key". This table is included in the DataEnvironment of one of my form, with Private DataSession. Problem occur when I tried to add (by APPENDing) a new record with a value which had been deleted previously. The message I got is "Uniqueness of Index KEY is violated." By PACKing the table after DELETEing a record would solve the problem. Is there any other way (other than RECALLing) which I could use back the same KEY value without having to pack the table? 'Cos I don't want to open the table as EXCLUSIVE.
>>>>>>
>>>>>>Thanks,
>>>>>>juan
>>>>>
>>>>>You touched the reason why primary key should be surrogate, e.g. sequential number, which will never be repeated.
>>>>You can define your primary index to "fieldname for not deleted()". There's been a bit of discussion on this subject, but I think that it is a valid alternative.
>>>
>>>This is not healthy alternative, primarily because index tags with FOR filter cannot be used for Ruhshmore purposes.
>>True enough. I also have the primary field indexed without a fliter clause.
>
>Yes, but it will not be 'primary' key anymore and you cannot use it for RI triggers or for View key fields etc.
You are correct, but I still have the primary index (with the for not deleted()) that I can use for the RI and Views. I have the added advantage of using the regular key field index to see all of the changes made a "record".

A little off the subject...Be aware that I had to correct the RI code for cascading deletes ( a bug verified by MS) when using SQL delete/insert updates
L.A.Long
ProgRes
lalong1@charter.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform