Hi Peter,
in case You just want to be shure not to destroy an already existing
table by creating it again, You can just isse an $dbh-do(CREATE
TABLE...). An already existing table will never desroyed and a warning
will be raised.
Greetings
Robert
-
Loo, Peter # PHX wrote:
Hi All,
1. Look in the data dictionary
2. Select from the table and trap the appropriate error code
-Original Message-
From: Loo, Peter # PHX [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 27, 2006 4:33 PM
To: List - DBI users
Subject: Checking if a table exist
Hi All,
Does anyone know of
Reidy, Ron wrote:
1. Look in the data dictionary
2. Select from the table and trap the appropriate error code
-Original Message-
From: Loo, Peter # PHX [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 27, 2006 4:33 PM
To: List - DBI users
Subject: Checking if a table exist
Hi All,
On 4/27/06, Loo, Peter # PHX [EMAIL PROTECTED] wrote:
Does anyone know of a good way to check if a table exist disregarding
whether the table has data or not?
Simplest is:
my $sth = $dbh-prepare(SELECT * FROM $tablename);
if ($sth) { ...table exists...probably; you might need to do
On Thu, 27 Apr 2006 17:17:26 -0700, Jonathan Leffler wrote:
Hi Jonathan
my $sth = $dbh-prepare(SELECT * FROM $tablename);
if ($sth) { ...table exists...probably; you might need to do $sth-
execute to be sure as different DBMS differ... }
else { ...table probably doesn't exist, or it
users
Subject: Re: Checking if a table exist
On 4/27/06, Loo, Peter # PHX [EMAIL PROTECTED] wrote:
Does anyone know of a good way to check if a table exist
disregarding
whether the table has data or not?
Simplest is:
my $sth = $dbh-prepare(SELECT * FROM $tablename