Home > Archive > MySQL ODBC Connector > January 2006 > rentering a sql script









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author rentering a sql script
Jon Miller

2006-01-01, 7:23 am

--=_B3914B19.57364DAD
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

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?

--=_B3914B19.57364DAD
Content-Type: text/plain
Content-Disposition: attachment; filename="TEXT.htm"
Content-Description: HTML

<!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>


--=_B3914B19.57364DAD
Content-Type: text/plain; charset=us-ascii


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw
--=_B3914B19.57364DAD--
David Logan

2006-01-01, 7:23 am

-------------- 06080703010107050108
0800
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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...e-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


-------------- 06080703010107050108
0800--
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com