Jon Miller wrote:

I have a sql script that needs to be re entered using the following command mysql 
< create.sql but the database already exists.  IS there a way to overwrite or 
update the database using the script, or do I have to delete the existing database?
------------------------------------------------------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY style="MARGIN-TOP: 2px; FONT: 10pt Arial; MARGIN-LEFT: 2px">
<DIV>I have a sql script that needs to be re entered using the following command mysql &lt; create.sql but the database already exists.&nbsp; IS there a way to overwrite or update the database using the script, or do I have to delete the existing database?</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------------------------------------------------------------------------


Hi Jon,

You will have to drop the database first if you wish to start from scratch. If you wish to update the records, the syntax at http://dev.mysql.com/doc/refman/5.0/en/create-database.html would be useful, especially the IF NOT EXISTS bit. This will allow you to bypass the CREATE DATABASE requirement. You may also use a similar syntax for the CREATE TABLE statement.

Regards

--

David Logan
South Australia

when in trouble, or in doubt
run in circles, scream and shout

Reply via email to