>>>>> "Derek" == Derek Lavine <derek@stripped> writes:
Derek> Thanks for the suggestions so far but I think I was not clear enough, sorry.
Derek> What I have is an SQL script that creates a number of tables. Before each
Derek> create I want to check if the table already exists and if it does I will not
Derek> create it. I need to do this as otherwise as soon as an error is encountered
Derek> (which it is if one tries to create a tablethat already exists) the script is
Derek> aborted
Derek> e.g.
Derek> ./mysql -u user -p password mydb < mysqlscript.sql
Derek> if mysqlscript.sql contains a create for a table that is already present the
Derek> script will be aborted. I don't know how (in the script) to check if the
Derek> table is present.
Derek> Is there a way of doing this or will I have to write a perl script that will
Derek> call individual create table scripts if the table does not exist.
Hi!
You can in always use:
./mysql -u user -p password --force mydb < mysqlscript.sql
This will continue your script even in case of errors.
Regards,
Monty
PS: MySQL 3.23 supports the CREATE TABLE IF NOT EXIST syntax.