Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleted key in database prevents APPEND
Message
From
14/10/2002 16:53:07
Al Doman (Online)
M3 Enterprises Inc.
North Vancouver, British Columbia, Canada
 
 
To
14/10/2002 16:37:20
William Sherman
Allegheny County Bar Association
Elizabeth, Pennsylvania, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00711113
Message ID:
00711123
Views:
12
>I have a database in a pricing app. SET DELETED is ON. There are various child records in three related files to the the primary key file in file Primex. When a record is deleted in file Primex and then a subsequent APPEND BLANK is used to append a new record I get the message 'Uniqueness of index file is violated'...how should I handle this ? Packing is a problem in the shared multiuser environment.
>Appreciate any help...Thanks,

As you've found, even DELETEd records count as far as PK uniqueness is concerned. If you're using APPEND BLANK, a blank PK value is created. If there is already one in the table you get the error.

If you know what your new PK value is going to be you can use INSERT - SQL instead (INSERT INTO ...) which puts the correct PK value in directly, avoiding a blank entry.

Depending on how you're managing your keys you might want to change the PK value of any record you delete to one which won't interfere with new PK generation. For example, for integer PKs you could make the values negative, or renumber them counting down from 2 billion.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform