Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleting duplicate records
Message
De
14/04/1999 15:35:01
 
 
À
14/04/1999 12:49:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00208276
Message ID:
00208352
Vues:
25
Have you step through the program with the debugger to see if it goes into the loop? BTW, I would suggest to move the PACK command outside the SCAN for a faster execution time.

>Im trying to write a program to delete duplicate records from
>a couple of database tables.
>I've has some help with this code but it doesn;t seem to be removing my records. Any input would be appreciated.
>close all
>set defa to \wincats\data
>
>use act_plan
>
>Select sin, add_date, add_time, count(*) as counter from Act_plan;
>Into Cursor Temp ;
>group by 1,2 ;
>having count(*) > 1
>
>Select Act_plan
>set order to Sin
>
>Select temp
>
>Scan
> If Seek(temp.sin + dtoc(temp.add_date) + temp.add_time , "Act_Plan") = .t.
> Skip in Act_plan
> nDeleterecords = temp.counter-1
> Delete Next nDeleterecords In Act_plan
> Pack
> Endif
>Endscan
>close all
>set defa to \wincats\data
>use coun_dtl
>
>Select sin, add_date, add_time, count(*) as counter from coun_dtl;
>Into Cursor Temp1 ;
>group by 1,2 ;
>having count(*) > 1
>
>Select coun_dtl
>set order to Sin
>
>Select temp1
>
>Scan
> If Seek(temp1.sin + dtoc(temp1.add_date) + temp1.add_time , "coun_dtl") = .t.
> Skip in coun_dtl
> nDeleterecords = temp1.counter-1
> Delete Next nDeleterecords In coun_dtl
> Pack
> Endif
>Endscan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform