Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help about Exporting .dbf to .csv

Status
Not open for further replies.

Const

Programmer
Jun 4, 2002
6
CA
I wanted to export the following table to a .csv file

sField1 sField2 sField3
Father Mother Brother

I obtained the following result:

sField1,sField2,sField3
Father,"Mother","Brother"

The code I used is:
Select 1
COPY TO (curdir() + "table") TYPE CSV

I want to know if it's normal that quotes appear.
Thanks
Const
 
I created a table with 3 character text fields like you did with the same names. I then used the same code and the out produced was without the double quotes. My machine assumes that a CSV file is an excel file.
 
If the output isn't what you require, you could use the low-level file functions and create your own output file.

BTW, I did the test and my result was with the quotes:

sfield1,sfield2,sfield3
"Father","Mother","Brother"

...and it imported into Excel without a problem. "I love work. I could sit and stare at it for hours..."
 
My results were:

sField1,sField2,sField3
"Father","Mother","Brother"

Yes, it is normal for quotes to appear. What format do you need?

Dave S.
 
one more vote for getting quotes around all fields.

check your output file again. are you using vfp 6 sp5? Attitude is Everything
 
CSV files by definition have quotes around character fields, otherwise if you had a comma embedded in one of your fields the entire file will be thrown off.

mday the reason you did not see the quotes is that excel strips them out when it loads the file. If you open the file in notepad or the foxpro editor you will see them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top