Problem : Select into OUTFILE — how do you append or delete

Problem : Select into OUTFILE   — how do you append or delete

I have a query that will run and create the file right, however now I need to make some edits. First I need a version that will append to an existing file…. and another that will delete the file if it exists.

so say I this was the query I was using what would it look like in the above situations…

SELECT insertstatement INTO OUTFILE ‘C:MW2MPconversion.sql’ from sqlinserts;


 

Solution: Select into OUTFILE   — how do you append or delete

You can’t from inside the mysql client.  You could from the command line, using redirection.
mysql [options] -e “SELECT insertstaement FROM sqlinserts” > fileToOverWrite
mysql [options] -e “SELECT insertstaement FROM sqlinserts” >> fileToAppend