Bob, That did the trick!

Thanks!

Mike

-----Original Message-----
From: Bessares, Bob [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 6:03 PM
To: [EMAIL PROTECTED]; Mike Koponick
Subject: RE: OUTFILE to CVS with headers

well, 
you can easily output into a comma separated file but the INTO OUTFILE
option will not allow you to retain the headers. You will need to build
the logic into a perl script or language of your choice to get the
headers there. Sounds like your fields records are all on one line
becausing you're not ending lines with a new line... try this.
SELECT Fields FROM databasename WHERE (criteria) INTO OUTFILE
'pathtofile/filename.csv' FIELDS TERMINATED BY '\,' OPTIONALLY ENCLOSED
BY '\"' LINES TERMINATED BY '\n'";
i hope this helps...

> ----------
> From:         Mike Koponick
> Sent:         Thursday, June 24, 2004 5:51 PM
> To:   [EMAIL PROTECTED]
> Subject:      OUTFILE to CVS with headers
> 
> Hello,
> 
> I'm working on a project where I must export to a text file and the
text
> file needs to be formed into columns so that it can be imported into a
> WORD mail merge document.
> 
> So, the format of the output file has to have the headers for each
> column and the lines must have a CR at the end of each line in order
to
> keep the columns formatted.
> 
> Here is what I'm doing now:
> 
> select created, status,user, comment1,  comment7, comment8, trouble
from
> tbl WHERE customer = 'customer' AND created BETWEEN '2004-05-31' AND
> '2004-06-25' ORDER BY created, status into outfile 'test5.txt' fields
> terminated by ',' optionally enclosed by '"' escaped by '\\';
> 
> All the lines run together so it makes it impossible to import.
> 
> Thanks in advance for your help.
> 
> Mike
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
are
> addressed. Please report errors to [EMAIL PROTECTED] 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> 

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to