lunes, 17 de diciembre de 2012

sql to txt file

para guardar una consulta en un txt, simplemente:
SELECT order_id,product_name,qty FROM orders
INTO OUTFILE '/tmp/orders.txt'
se pueden usar modificadores para alterar el comportamiento al guardar:
SELECT order_id,product_name,qty FROM orders
INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'