At 12:02 PM +1000 6/9/1999, 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
>./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.
You'll probably have to write a script. Your problem involves executing
a query contingent on the results of earlier queries, which is difficult to
achieve with straight SQL.
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/