[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1920
  • Last Modified:

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:\\MW2MP\\conversion.sql' from sqlinserts;
0
Isisagate
Asked:
Isisagate
1 Solution
 
snoyes_jwCommented:
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
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now