Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleting duplicate records
Message
From
14/04/1999 15:35:01
 
 
To
14/04/1999 12:49:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00208276
Message ID:
00208352
Views:
26
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
Previous
Reply
Map
View

Click here to load this message in the networking platform