Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GET RID OF DUPLICATES
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00446244
Message ID:
00446299
Vues:
9
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform