Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql server - vfp how?
Message
De
12/04/2012 08:20:33
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
11/04/2012 11:34:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01541027
Message ID:
01541187
Vues:
46
>How can I create a table in SQL from VFP and populate it from a cursor?

You send a CREATE TABLE command and then a bunch of insert statements... in metacode
sqlexec(h, "create table mytable (field1 ..., ...)")
select mycursor
scan
   sqlexec(h, "insert into mytable (field1, field2, ...) values (?mycursor.field1, ?mycursor.field2, ...)")
endscan
If it's a temp table, then prefix it with # on SQL side and issue a "drop table #mytable" when you don't need it anymore.

Error handling, optimization (like not sending more than one statement per sqlexec()), and actual fields are left as en exercise to the reader :).

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