my-cmd - MySQL interactive and batch query command-line tool »

Download my-cmd Free Trial »

Unload MySQL data to flat file (CSV, TSV, TXT)

parameters:

delimiter: delimiter char ("|",",","#","TAB","WHITESPACE")

quote: quote char (quote=' => single quotes, quote=" => double quotes)

recorddelimiter: record delimiter, default is CRLF

header: y|n, print field name at first line

table: table name ("all" for unload all table)

query: sql query string (can not use multi-line sql)

sqlfile: sql script file contains the query you want to unload

schema: schema name, use this prameter to unload specific schema's data, if not set, use logon user's default schema

datafile: data file name

folder: data files folder (for unload all table)

dateformat: date format (e.g. "yyyy-mm-dd hh24:mi:ss")

timestampformat: timestamp format (e.g. "yyyy-mm-dd-hh24.mi.ss.ff6")

quit = y|n (quit my-cmd after run in batch mode)


Unload table example my-cmd> unload table=jobs datafile=e:\temp\tables\jobs.txt delimiter="," header=y;
Unload query example my-cmd> unload query="select job_id,job_title from jobs" > datafile=e:\temp\tables\jobs_part.txt > delimiter="," > header=y;
Unload as sqlfile example sqlfile content: unload_jobs.sql select job_id,job_title from jobs my-cmd> unload sqlfile=e:\temp\tables\unload_jobs.sql > datafile=e:\temp\tables\jobs_part2.txt > delimiter="," quote=" > header=y;
Unload schema example my-cmd> unload table=all folder=e:\temp\tables delimiter="," header=y;
In batch mode my-cmd dsn="pan:withdata@192.168.0.102:3306/test" task=unload table=all folder=e:\temp\tables delimiter="," header=y quit=y