Subject Re: creating a CSV file form a DBF
From Mervyn Bick <invalid@invalid.invald>
Date Fri, 10 Aug 2018 17:46:42 +0200
Newsgroups dbase.getting-started

On 2018-08-10 4:13 PM, Ed Furche wrote:
> Is this the right command or not?  Doesnt seem to work in dbase or command prompt.
>
> COPY TRAKSDF.DBF G:\VISPLUS\TRAKSDF.CSV TYPE SDF DELIMITED WITH ","
>

The syntax is not quite right. And it's not quite clear what you
actually want.

.CSV (Comma Separated Values) files have values separated by commas and
the record lengths will vary depending on the contents of the various
fields.

SDF (Standard Data Format) files are usually saved as .txt files
although the extension in both cases is not important.  In SDF files the
record lengths are all the same and the data for each field is padded
with spaces to the length of the field in the table.

use traksdf
copy to g:\visplus\traksdf.csv delimited
use

This will give you a .csv  file with character fields wrapped in double
quote marks.  If you want the character fields wrapped in single quotes then

copy to g:\visplus\traksdf.csv delimited with '

For an SDF file

use traksdf
copy to g:\visplus\traksdf.txt sdf
use


I both cases dates are written as yyyymmdd.  dBASE will read both
formats into a table but Excel does not recognise this form as a date in
a .csv file.

If you need to read the resulting .csv table into Excel (or other
program which does not accept yyyymmdd as a date format have a look at
usvout.prg in the dUFLP.

Mervyn.