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

EXPORTING COMMA DELIMITED FILES 2

Status
Not open for further replies.
Jul 7, 2003
95
US
I am exporting a file that has to be comma delimited. NO quotes, just the comma.

My fields are Nickname,fullname,firstname... etc

My results are as follows

,Nickname,,,FullName,,,FirstName,,,

Why am I getting extra commas where no fields exist and what command should I be using? Has anyone else had this problem before?

Thanks in advance,

Will
 
hi will,

what command do you use?
could you send your code?
any strange values in your table?

cheers

alex
 
It sounds like you selected a few other fields that do not have data in them and the extra comma is a placeholder.

Try exporting just the 3 fields (or how ever many) you need. Jpwever, You will still get an extra comma as a placeholder in fields that are blank.

Jim Osieczonek
Delta Business Group, LLC
 
Hi
SInce delimeter character is , and the character fields can contain a , as content of field, the COPY TO command will always put a double quote around the exported character fields.

HOwever, you can use this the following to get only a , between the fields..

COPY TO test.txt DELIMITED WITH "" WITH CHARACTER ","


:)

ramani :)
(Subramanian.G)
 
All the fields are populated, there are no imbedded commas, I've tried the following:

COPY TO test.CSV FIELDS NICKNAME,NAME,FIRST ... etc

COPY TO test.csv DELIMITED WITH ,

Both results the same.
 
COPY TO test.txt DELIMITED WITH "" WITH CHARACTER ","

didnt work... ??

and copy to delimited always gives a quote comma file.
 
HI
USE myTable
COPY TO test.txt DELIMITED WITH "" WITH CHARACTER ","

This worked perfectly in VFP and VFP 8

A sample I copied in VFP7 is below..
This is having one numeric one character and one blank chr field atleast

1,gs,
2,tg,
3,kk,
4,aa,
5,,
6,,
7,,
8,,
9,,
10,,

:)

ramani :)
(Subramanian.G)
 
I have ver 6.0

The message I get with that command is
"command contains unrecognized phrase/keyword.

ver 6.0 doesnt support it?
 
What Service Pack Level are you running in VFP 6.0? I believe the syntax changed a bit in SP3, and you really should be using SP5.

Rick
 
Not sure of service pack.

the complete version is 06.00.8167.00

How do I get the service pack I need?
 
Still frustrated....

I downloaded and updated the service pack.

COPY TO test.txt DELIMITED WITH "" WITH CHARACTER ","

the above command still gives me the same error.

There must be a way to eliminate all these extra commas in my delimited files...

Any other ideas?

 
I don't know why you are having the problem you are, but would you consider a small piece of code to achieve the end result?
 
Something along the lines of...

<code>
use myDBF
set alternate to myfile.txt
set alternate on
scan

? alltrim(firstname)+&quot;,&quot;+alltrim(lastname)+&quot;,&quot;+alltrim(nickname)

endscan
set alternate off
set alternate to

</code>
 
Try this:

SET HEADING OFF
LIST OFF Field1 + ',' + Field2 + ',' + Field3 ..... ;
TO MyFile.TXT

Of course, you need to convert non character types to character but, it should still do the trick.


-Dave S.-
[cheers]
Even more Fox stuff at:
 
I hope you all understand... I do not want any quotes... just commas. Right? Getting quote comma is easy... getting just commas keeps inserting two extra commas between the fields.
 
Neither of those examples should give you any quotes. Did you try them?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top