How can I include today's date in filename .csv when using OUTFILE using MySQL
Posted on 2016-08-11
I need to create export a csv file that should be named with date i.e. file20160811.csv
I have my query.
I tried this:
SET @sql_text = CONCAT("Select * from Table1 into outfile 'C:\desktop\",date_format(NOW(),'%Y%m%d'),".csv'");
PREPARE statement FROM @sql_text;
I got error Code 1064, error SQL syntax...
can someone help me to fix this?
Thanks in advance.