Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Record eval. too slow
Message
De
27/05/1999 09:42:34
 
 
À
27/05/1999 08:54:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00223386
Message ID:
00223413
Vues:
20
>I am trying to append or update from 1 table to another. They both have the same structure. I cannot make changes to the source table as it beelongs to another company. The source table has no unique field, however, a combination of 3 fields is unique. So I set an index in the target table consisting of these 3 fields. I must evaluate each record in the source table, if it does not exist in the target table I append it. If it does exist, I must see if it has been updated and if so, update the appropriate fields. This is working o.k. but it is very slow as the target table continues to grow and my do while not eof() and seek commands seem to be the only way to make my updates. Any suggestions would be appreciated.
>
>for example the 2 tables have fields A - E.
>None are unique but A + B + C is unique
>
>use table 1
>do while not eof()
> store A + B + C to memvar
> use table 2
> seek A + B + C
> if found()
> if fields D + E dont match
> update
> endif
> else
> append record from table1
> endif
> skip
>enddo

you can also do it with a 3 part SELECT statement
one that fetches records that don't have to get updated in table2
one that retrives the records from table1 that don't exist in table2
and one that retrives the records from table1 where D+E are different and A+B+C are the same

Arnon
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform