I am exporting a table using -
SELECT * INTO OUTFILE 'd:\\result.txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM result;
Now I want to run this script daily by putting it in procedure. And I want use file name "result" with date or some other dynamic number which i can increase daily. Otherwise it will give me error for the duplicate file name.
I should be like -
declare var_result varchar(100);
set var_result = 'result01012014';
SELECT * INTO OUTFILE var_result
................................
Is it possible?
Instead of creating
Stored Procedure
You can create ashell or php
script for the sameExample of a shell script that I usually use
This will create file name like
City-2014-02-20.csv
Stored procedure to do the same