What about the modifier to create table (if not exists).
From the docs:
CREATE TABLE [IF NOT EXISTS] tbl_name ...
-Troy Cobb
Circle Net, Inc.
http://www.circle.net
> -----Original Message-----
> From: Sasha Pachev [mailto:sasha@stripped]
> Sent: Wednesday, June 09, 1999 12:51 AM
> To: Derek Lavine
> Cc: mysql-help
> Subject: Re: Table exists ?
>
>
> Derek Lavine wrote:
> >
> > Thanks for the suggestions so far but I think I was not
> clear enough, sorry.
> >
> > What I have is an SQL script that creates a number of
> tables. Before each
> > create I want to check if the table already exists and if
> it does I will not
> > create it. I need to do this as otherwise as soon as an
> error is encountered
> > (which it is if one tries to create a tablethat already
> exists) the script is
> > aborted
> >
> > e.g.
> >
> > ./mysql -u user -p password mydb < mysqlscript.sql
> >
> > if mysqlscript.sql contains a create for a table that is
> already present the
> > script will be aborted. I don't know how (in the script)
> to check if the
> > table is present.
> >
> > Is there a way of doing this or will I have to write a
> perl script that will
> > call individual create table scripts if the table does not exist.
> >
> > Thanks again
> >
> > derek
> >
>
> Here is a dirty trick I use in situations that are probably
> similar to
> yours:
>
> mysql -f -uuser -psecret < file.sql
>
> That will force the script to continue even if an error
> occurs, quick
> and dirty, but does the job.
>
> --
> Sasha Pachev
> http://www.sashanet.com
>
> ------------------------------------------------------------
> ---------
> Please check
"http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail mysql-thread4831@stripped
To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail mysql-unsubscribe@stripped instead.