Have your script delete it first.

Niklas Rudemo wrote:
> 
> Maybe I didn't state the problem clearly enough.
> I want write to a file that does exist,
> i.e., overwrite the existing file.
> 
> -----Original Message-----
> From: Paul DuBois [mailto:[EMAIL PROTECTED]]
> Sent: den 9 april 2001 17:01
> To: Niklas Rudemo
> Cc: [EMAIL PROTECTED]
> Subject: Re: select into outfile problem
> 
> On Mon, Apr 09, 2001 at 03:48:43PM +0200, Niklas Rudemo wrote:
> > I'm trying to select into outfile to a file that already exist.
> > This has been discussed before, I know, but the solution suggested
> > results in an SQL-error, as shown below. So what's the real solution?
> 
> Select your rows into a temporary table, which will allow you to run
> several queries to obtain the rows.  Then use SELECT ... INTO OUTFILE
> with the temporary table (into a file that doesn't exist).
> 
> >
> > Niklas Rudemo
> > Virtutech
> >
> > mysql> select * into outfile 'person.txt' from person;
> > Query OK, 0 rows affected (0.00 sec)
> >
> > mysql> select * into outfile 'person.txt' from person;
> > ERROR 1086: File 'person.txt' already exists
> >
> > mysql> select * into outfile 'person.txt' REPLACE from person;
> > ERROR 1064: You have an error in your SQL syntax near 'REPLACE from
> person'
> > at l
> > ine 1
> 
>

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to