Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Appending to DBF from a Remote View
Message
De
24/12/2007 12:15:14
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
23/12/2007 18:39:31
Irv Adams
MSC Managed Care, Inc.
Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01276924
Message ID:
01277370
Vues:
26
This message has been marked as a message which has helped to the initial question of the thread.
>>>>Try
>>>>APPEND FROM (DBF("MyView"))
>>>>* Or
>>>>INSERT INTO mytable (<field list>)
>>>>SELECT <field list> FROM MyView
>>>>
>>>
>>>I temporarily forgot about Fox's powerful SELECT-SQL command; I think I'll go with that one.
>>>Thanks Sergey!
>>
>>It's not SELECT-SQL, it's Insert-SQL <g>
>
>Hi Naomi,
>
>I used a SELECT-SQL from the Remote View into a cursor, for needed columns only; this part works fine. The final destination for the data, however, is actually a DBF that I need to refresh. It needs to be totally overwritten by the contents of the cursor. I wanted to avoid the ZAP/APPEND commands to refresh it since it's sometimes dangerous to ZAP tables.
>
>Could you suggest an alternative? Some form of INSERT-SQL or UPDATE-SQL?

Both - you can't update records which don't exist, so you must insert them first; and you shouldn't insert the same records twice, right? Therefore, updates where {key exists}, insert where {key not found in target table}.

There's maybe a simpler way - just delete the records which would be updated, then insert all. I've done it in one situation, when I was updating a remote server. I'd create a temp table, insert into it, then delete from target table for all keys found in the temp table, then insert all from the temp table into the target table, then discard the temp table. The good side of this was the single trip to the server - all of these commands can be sent at once, I didn't need to retrieve anything to know what to send.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform