Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GET RID OF DUPLICATES
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00446244
Message ID:
00446299
Views:
14
I may be stating the obvious, but be sure to backup your table before running this piece of code. If the power goes down between the ZAP and the APPEND statements, you will loose all the data.

I don't want to be picky, but since VFP will open the table if it is not allready open in a SELECT-SQL, the IF condition isn't necessary and the code may be reduced to:
select distinct * from table into cursor cursa
use in table
use table excl
zap
append from dbf('cursa')
use in table
use in cursa

>One way is to do a select distinct on the table, zap it, then do an append from the select result.
>select distinct * from table into cursor cursa
>if !used('table')
>    use table excl
>    zap
>    append from dbf('cursa')
>else
>    use in table
>    use table excl
>    zap
>    append from dbf('cursa')
>endif
>use in table
>use in cursa
>Now you have a table with no duplicate records. The next thing is arranging the app to not allow duplicates to be created.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform