Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating records in FoxPro tables
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00565010
Message ID:
00565101
Views:
25
>>< SNIP >
>>>>
>>>>Ok, you got me :)
>>>
>>>:) On the serious note, if we need to delete all dups but one, I think, Ron's solution is the perfect one and it's a standard for this kind of situation.
>>
>>I have to disagree with you.
>>First, the code he provided is incorrect and will leave only duplicates in the table. Second, if implemented properly, it has some limitations:
>>- The table cannot have deleted records before this operation
>>- It requires to delete all records in the table that could be slow on the big table
>>- It requires creating a new index and on the big table it could take a long time
>>- It requires to recall almost all records in the table that could be time consuming on the big table also.
>
>Ok, you're right. Scanning big table is also time consuming, though :) Let's find out the optimum algorithm.
>
>How about:
>1) Create cursor curDupes as I described

Or
>
>scan && curDupes
>  lnKeyID = KeyID
>  select MainTable
>  locate for KeyID= lnKeyID     <b>&& or SEEK(KeyID)</b>
   <b>SKIP</b>   && leave the first record
>  scan while KeyID = lnKeyID
>     delete
>  endscan
<b>*  if !bof() && should not be
*      skip - 1
*      recall && last dup record is undeleted
*  endif</b>
>endscan
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform