Tuesday, May 19, 2009

Export MySQL Data to Comma Seperated File

SELECT `doc_no`,`column1`,` column2`,` column3`

INTO OUTFILE 'C:\\result.txt'

FIELDS TERMINATED BY ','

OPTIONALLY ENCLOSED BY '"'

LINES TERMINATED BY '\n'

FROM table_name;

Here 

`doc_no`,`column1`,` column2`,` column3`  are the column name which you want to export

'C:\\result.txt' is the exported csv file name.

table_name is the table which you want export in to csv


No comments:

Post a Comment