We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Select into OUTFILE   -- how do you append or delete

Isisagate
Isisagate asked
on
Medium Priority
1,981 Views
Last Modified: 2008-01-09
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;
Comment
Watch Question

Top Expert 2005
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.