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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

export to csv without fieldnames? 1

Status
Not open for further replies.

foxup

Programmer
Dec 14, 2010
328
CA
Hi,

Just a simple question. I have a .DBF that I want to execute this command: "COPY TO result TYPE CSV". The result is I get each field rapped in quotes. Is it possible to 'copy to / or export" in CSV without the quotes (delimited) for each field. Basically I just want comma's in between each field. Also,is ti possible to not get the fielnames in row 1 of my exported result file. I simply want the data demlimited withoput any quotes and I do not want the fieldnames there. can it be done?


please let me know.

Thanks,
FOXUP
 
To get rid of the field headings, use [tt]DELIMITED[/tt] rather than [tt]TYPE CSV[/tt].

Off the top of my head, I'm not sure about getting rid of the double-quotes. You need some combination of [tt]DELIMITED WITH ... WITH CHARACTER ...
[/tt]

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
As I can never figure out which way round to put the [tt]DELIMITED WITH[/tt] and [tt]WITH CHARACTER[/tt] clauses, I thought I would check the ever-reliable HackFox. This is what it says:

On the whole, the choices are quite a mess. If you're still confused by this, we suggest you do what we did to figure all this out. Try COPY TO with each option on a small data sample.

Which is exactly what I usually do.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Works like a charm Mike, as usual. :) Thank you.

Star 4 U. :)


Thanks again,
FOXUP
 
There's another way to cast the data from a DBF into an ASCII file: COPY TO result TYPE SDF. Then, you will not get those double-quotes, neither fields' names. But neither any separation between the columns if they are filled to capacity. E.g., if you have in your DBF fields cust_PK C(4), cust_Name C(30), you might get something like

0001ABC NETWORK, INC.
0002CBS NETWORK, INC.

etc., you've got the idea.
If you're sure you wont have this problem - you'll be fine.

HTH.


Regards,

Ilya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top