Re: ?? If Table Exists, Drop Table, then Create Table ??
| From: | Dobromir Velev | Date: | Wed, 28 Nov 2001 08:10:22 +0000 |
| Subject: | Re: ?? If Table Exists, Drop Table, then Create Table ?? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-14638@lists.php.net to get a copy of this message | ||
Hi,
All MySQL version higher than 3.22 support the following syntaxis
DROP TABLE IF EXISTS tbl_name
HTH
Dobromir Velev
-----Original Message-----
From: MrBaseball34 <mrbaseball34@hotmail.com>
To: php-db@lists.php.net <php-db@lists.php.net>
Date: Tuesday, November 27, 2001 18:37
Subject: [PHP-DB] ?? If Table Exists, Drop Table, then Create Table ??
>Table Creation Script from SQL Server...
>
>if exists (select * from dbo.sysobjects where id =
> object_id(N'[dbo].[Orders]') and
> OBJECTPROPERTY(id, N'IsUserTable') = 1)
>drop table [dbo].[Orders]
>GO
>
>CREATE TABLE [dbo].[Orders] (
> [OrderID] [int] IDENTITY (1, 1) NOT NULL,
> .
> .
> .
> .
> );
>GO
>
>Is there anything like the first line from mySQL?
>I need to check if a table exists and drop it if it
>does so it can be recreated. I do not have access to
>any admin facilities on my host so I need to be able
>to do this in a script I can modify.
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
>For additional commands, e-mail: php-db-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>