Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inserting Records From CSV File
Message
 
À
26/06/2017 13:27:55
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01652199
Message ID:
01652217
Vues:
49
>>>Thanks. I'm using VFP 6.0. Thought I could do something like
>>>
>>>Insert into mynewdbf from customers.csv
>>
>>select mynewdbf
>>append from customers.csv csv fields field1, field2 .... fieldn && field? is a field of mynewdbf
>
>The law of unintended consequences says that this will insert the first field from csv into field1, second into field2 etc. If you issue
>
>append from customers.csv csv fields field1, field4, field7
>
>then you'll get first field from csv into field1, second into field4, third into field7. IOW, a csv is not a table, so its headers don't mean a thing to append command; it actually better not have the row which pretends to be a header.
>
>If you want to select certain fields only, i.e. skip some fields from the csv, then first create a cursor which has all the fields, append from csv into it, then append from that cursor only the fields you want.

You are right, and it was my intention to point that out after I posted. I clicked "update" started writing the message but got distracted by something else and never finished the update.
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform