Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleted key in database prevents APPEND
Message
De
14/10/2002 16:53:07
Al Doman (En ligne)
M3 Enterprises Inc.
North Vancouver, Colombie Britannique, Canada
 
 
À
14/10/2002 16:37:20
William Sherman
Allegheny County Bar Association
Elizabeth, Pennsylvanie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00711113
Message ID:
00711123
Vues:
13
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform