Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code to delete duplicate records
Message
From
04/07/1998 10:55:30
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00113312
Message ID:
00114235
Views:
17
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform