Information générale
Catégorie:
Codage, syntaxe et commandes
>I would like some suggestions for writing some
>code to delete duplicate records that are created
>on append and insert.
>
I just read this thread, but I can't believe noone mentioned
the elegant technique by Grommes and Jinkerson in Foxtalk "The
Pros Talk"
They say to develop a unique match key as an index
(no unique field necessary). This way you can
re-evaluate and change your match key as required.
SET DELTED OFF
USE TableName EXCLUSIVE
DELETE ALL
INDEX ON &MatchKey UNIQUE TO TempIDXName COMPACT
RECALL ALL
CLOSE INDEX
These six commands will open and de-dup table "TableName"
based on any matchkey "&MatchKey", using temporary index
"TempIDXName". DELETE ALL marks all records for deletion,
The UNIQUE index creates a key for the first occurence of
each uniquey matchkey. RECALL ALL will recalls only
unique records since UNIQUE index is active.
SET DELETE on or PACK and you are ready to go.
This little technique gives me much joy.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement