PDA

View Full Version : Writing SQL query output into text files of fixed size


josepjerry
Oct 9, 2011, 11:24 PM
I have a stored procedure in MySQL that writes the output of a query to a textfile
Using SELECT * FROM tbl INTO OUTFILE <file_name_datetime>. I call this procedure from a Linux shell script for automated file generation.

I want to configure this process, by defining the maximum filesize during a scheduled run.
If the filesize exceeds the limit, write the rest of data into a second file and if second file
Exceeds the limit, then into a third and so on. Can anyone help?