General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only