Saturday, 23 April 2016

How to write output of SQL query to a text file ?


Run the SQL command with SELECT...INTO clause :

SELECT ...
INTO OUTFILE "/tmp/out.csv" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\n'
FROM  ...
WHERE ...

No comments:

Post a Comment

Note: only a member of this blog may post a comment.