Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy To CSV and Field With Quotes and Commas
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Divers
Thread ID:
01392202
Message ID:
01392252
Vues:
93
This message has been marked as the solution to the initial question of the thread.
You have to double double-quotes before copy to csv file
...
UPDATE c_test SET textfld1  = STRTRAN(textfld1, ["], [""])
COPY TO myfile.csv TYPE CSV 
Or you may consider alternative way of importing VFP data into Excel as in Can somebody please give a hand? Message #1386305

>If you use the copy to csv command with a cursor that has a text field that has quotations and commas, you can end up with a csv file that cannot be opened by Excel properly.
>
>
>create cursor c_test (textfld1 C(50), numfld1 N(10,2))
>
>insert into c_test (textfld1,numfld1) values ('test test',12345.67)
>insert into c_test (textfld1,numfld1) values ('test 9", test 10", test',12345.67)
>insert into c_test (textfld1,numfld1) values ('test test',12345.67)
>
>
>COPY TO c:\foxpro\myfile.csv TYPE CSV 
>
>
>You see how that second row will take 4 columns to display in Excel instead of just 2 columns like it should?
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform