Re: How to determine if temporary table exists

2008-11-21 Thread mos
eption in my program. I thought there should > be an easy way using SQL to determine if a temporary table exists or > not. Why not "CREATE TEMPORARY TABLE IF NOT EXISTS ..."? If you really need to know whether the table existed before or not, that command will return a warning if it

Re: How to determine if temporary table exists

2008-11-20 Thread Dan Nelson
should > be an easy way using SQL to determine if a temporary table exists or > not. Why not "CREATE TEMPORARY TABLE IF NOT EXISTS ..."? If you really need to know whether the table existed before or not, that command will return a warning if it was there already. htt

Re: How to determine if temporary table exists

2008-11-20 Thread mos
eate it. I suppose could count the rows in Tablex and it would throw an exception if the table did not exist . But I really didn't want to resort to trapping an exception in my program. I thought there should be an easy way using SQL to determine if a temporary table exists or not. Mike

Re: How to determine if temporary table exists

2008-11-20 Thread Moon's Father
Try drop table if exists Tablex; On Fri, Nov 21, 2008 at 9:53 AM, mos <[EMAIL PROTECTED]> wrote: > How can I determine if a temporary table exists? Normally I use something > like: > > create temporary table Tablex like Table1; > show tables like "Tablex"; > &g

How to determine if temporary table exists

2008-11-20 Thread mos
How can I determine if a temporary table exists? Normally I use something like: create temporary table Tablex like Table1; show tables like "Tablex"; but the Show Tables never displays any rows for a temporary table even though the temporary Tablex exists. (All in same thread). So

RE: Detect if table exists from within MySQL?

2005-10-06 Thread Ryan Stille
> Maybe you could use > > SHOW TABLES LIKE 'your_table'; That's a great idea, I just tried it in several ways, like: IF EXISTS (SHOW TABLES LIKE 'cfgbiz') THEN SELECT siacnotifyto FROM cfgbiz ELSE SELECT '' as siacnotifyto END IF; -and- select IF((SHOW TABLES LIKE 'cfgbiz'),notifyto

Re: Detect if table exists from within MySQL?

2005-10-06 Thread Jeff Smelser
On Thursday 06 October 2005 10:57 am, Ryan Stille wrote: > I am converting some code from MSSQL to MySQL. In one place I need to > have a conditional query depending on if a table exists or not. There > are different versions of this application and the table only exists in > some of

Re: Detect if table exists from within MySQL?

2005-10-06 Thread Keith Ivey
Ryan Stille wrote: If I have to, I could resort to doing another query in my application (SHOW TABLES) and seeing if my table was returned in that list. But I was hoping for a more elegant way to do it, within the single query. Maybe you could use SHOW TABLES LIKE 'your_table'; -- Keith

RE: Detect if table exists from within MySQL?

2005-10-06 Thread Ryan Stille
> If 'SHOW COLUMNS FROM tablename' returns error 1146 (42S02), the > table doesn't exist. This causes my application (ColdFusion) to throw an exception. If I have to, I could resort to doing another query in my application (SHOW TABLES) and seeing if my table was returned in that list. But I wa

Re: Detect if table exists from within MySQL?

2005-10-06 Thread Peter Brawley
Ryan, >I am converting some code from MSSQL to MySQL. In one place I need to >have a conditional query depending on if a table exists or not. There >are different versions of this application and the table only exists in >some of them. Here is how it was done in MSSQL: If '

Detect if table exists from within MySQL?

2005-10-06 Thread Ryan Stille
I am converting some code from MSSQL to MySQL. In one place I need to have a conditional query depending on if a table exists or not. There are different versions of this application and the table only exists in some of them. Here is how it was done in MSSQL: IF OBJECT_ID('cfgbiz') I

Re: Determining if a table exists

2005-05-03 Thread Dusan Kolesar
this (old as alabama) application. They refuse to support newer versions of MySQL. - Original Message - From: "Eric Bergen" <[EMAIL PROTECTED]> To: "Jim McAtee" <[EMAIL PROTECTED]> Cc: Sent: Monday, May 02, 2005 11:31 AM Subject: Re: Determining if a table exists

Re: Determining if a table exists

2005-05-02 Thread Eric Bergen
riginal Message - From: "Eric Bergen" <[EMAIL PROTECTED]> To: "Jim McAtee" <[EMAIL PROTECTED]> Cc: Sent: Monday, May 02, 2005 11:31 AM Subject: Re: Determining if a table exists I don't remember what commands are available in 3.21 but try these show tables like &

Re: Determining if a table exists

2005-05-02 Thread Jim McAtee
is 3.23.x. Dictated by this (old as alabama) application. They refuse to support newer versions of MySQL. - Original Message - From: "Eric Bergen" <[EMAIL PROTECTED]> To: "Jim McAtee" <[EMAIL PROTECTED]> Cc: Sent: Monday, May 02, 2005 11:31 AM Subject: R

Re: Determining if a table exists

2005-05-02 Thread Eric Bergen
I don't remember what commands are available in 3.21 but try these show tables like 'table_name'; then check mysql_num_rows on the result. describe table; check mysql_num_rows show tables; then pick out the table name; 3.21 is old as alabama (forrest gump) it's time for an upgrade :) Jim McAtee wro

Determining if a table exists

2005-05-02 Thread Jim McAtee
We're running an application that creates table names in a numeric sequence. For example: jst998_foo jst998_bar jst999_foo jst999_bar jst0001000_foo jst0001000_bar jst0001001_foo jst0001001_bar I need to write a maintenance app that first needs to determine the numeric range of

Re: Is there a way to find out if a table exists?

2003-09-19 Thread Paul DuBois
At 3:37 PM -0500 9/19/03, Don Read wrote: On 19-Sep-2003 Don Read wrote: On 19-Sep-2003 Dan Anderson wrote: I am trying to make my PHP script autodetect when a table in a mySQL database exists, and when it doesn't, create it. function tableexists($tbl) { $res = @mysql_query("SELECT 1

Re: Is there a way to find out if a table exists?

2003-09-19 Thread Don Read
On 19-Sep-2003 Don Read wrote: > > On 19-Sep-2003 Dan Anderson wrote: >> I am trying to make my PHP script autodetect when a table in a mySQL >> database exists, and when it doesn't, create it. >> > > > function tableexists($tbl) { > $res = @mysql_query("SELECT 1 FROM $tbl"); > retur

Re: Is there a way to find out if a table exists?

2003-09-19 Thread Don Read
On 19-Sep-2003 Dan Anderson wrote: > I am trying to make my PHP script autodetect when a table in a mySQL > database exists, and when it doesn't, create it. > function tableexists($tbl) { $res = @mysql_query("SELECT 1 FROM $tbl"); return ($res ? true : false); } Regards, -- Don Rea

RE: Is there a way to find out if a table exists?

2003-09-19 Thread Jennifer Goodie
> Is there some way to do something like: > > SELECT * FROM tables WHERE name = "table_name"; > > And get a result I could test for truth, and thus run my script? Show tables like 'table_name'; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:htt

Re: Is there a way to find out if a table exists?

2003-09-19 Thread Roger Baklund
* Dan Anderson > I am trying to make my PHP script autodetect when a table in a mySQL > database exists, and when it doesn't, create it. > > Is there some way to do something like: > > SELECT * FROM tables WHERE name = "table_name"; > > And get a result I could test for truth, and thus run my scrip

Is there a way to find out if a table exists?

2003-09-19 Thread Dan Anderson
I am trying to make my PHP script autodetect when a table in a mySQL database exists, and when it doesn't, create it. Is there some way to do something like: SELECT * FROM tables WHERE name = "table_name"; And get a result I could test for truth, and thus run my script? Thanks in advance, Da

Re: Checking if a table exists?

2002-04-23 Thread Shaun Bramley
Sent: Tuesday, April 23, 2002 10:38 AM Subject: Re: Checking if a table exists? > At 04:58 AM 4/23/2002, you wrote: > >Hi! > > > >How do check if a certain table exists? I have to know if > >the table exists and then make a query in that > >table. I mean to use it in a

Re: Checking if a table exists?

2002-04-23 Thread BD
At 04:58 AM 4/23/2002, you wrote: >Hi! > >How do check if a certain table exists? I have to know if >the table exists and then make a query in that >table. I mean to use it in a function so the SHOW TABLES >is not an option... > >I have tried the "sysobjects&quo

Checking if a table exists?

2002-04-23 Thread Bo Mellberg
Hi! How do check if a certain table exists? I have to know if the table exists and then make a query in that table. I mean to use it in a function so the SHOW TABLES is not an option... I have tried the "sysobjects" solution but it comes back with: table 'lve.sysobjects' do

Re: how to check if table exists?

2002-03-29 Thread René Seindal
ple. > > You have written the following: > > On Thu, Mar 28, 2002 at 04:30:25PM -0600, BD wrote: > > At 06:20 AM 3/28/2002, you wrote: > > >> > > >> What is the fastest way to check if a table exists? > > >> Do a select and catch the error? > >

Re: how to check if table exists?

2002-03-28 Thread BD
At 06:20 AM 3/28/2002, you wrote: >On 27-Mar-2002 Ken Anderson wrote: > > > > > > > > > > > > What is the fastest way to check if a table exists? > > Do a select and catch the error? > > Try to create the table, and catch the error? >

Re: how to check if table exists?

2002-03-28 Thread Don Read
On 27-Mar-2002 Ken Anderson wrote: > > > > > > What is the fastest way to check if a table exists? > Do a select and catch the error? > Try to create the table, and catch the error? > Other options? > Thanks, > Ken Yes, in php: function tableexist

Re: how to check if table exists?

2002-03-27 Thread Ken Anderson
> > show tables like "tablename"; > > It'll either give an empty set, or return the tablename. > > -- > sh > > On Wed, 2002-03-27 at 14:29, Ken Anderson wrote: > > > > > > > > > > > > What is the fastest way to check if a ta

Re: how to check if table exists?

2002-03-27 Thread Steven Hajducko
-03-27 at 14:29, Ken Anderson wrote: > > > > > > What is the fastest way to check if a table exists? > Do a select and catch the error? > Try to create the table, and catch the error? >

Re: how to check if table exists?

2002-03-27 Thread Ken Anderson
What is the fastest way to check if a table exists? Do a select and catch the error? Try to create the table, and catch the error? Other options? Thanks, Ken sql,query - Before posting, please check: http

Re: Table Exists

2001-12-14 Thread sherzodR
] : Subject: Table Exists : : What is the easiest way to check if a table exists in the current : database? I checked the documentation, and couldn't find anything (but : maybe I missed it). : :

RE: Table Exists

2001-12-14 Thread Jonathan Hilgeman
e), or DESCRIBE tablename - Jonathan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, December 14, 2001 8:34 AM To: [EMAIL PROTECTED] Subject: Table Exists What is the easiest way to check if a table exists in the current database? I checked the doc

RE: Table Exists

2001-12-14 Thread Todd Williamsen
Mysql>show tables; Would be the easy way Thank you, Todd Williamsen, MCSE home: 847.265.4692 Cell: 847.867.9427 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, December 14, 2001 10:34 AM To: [EMAIL PROTECTED] Subject: Table Exists What is

Table Exists

2001-12-14 Thread gms8994
What is the easiest way to check if a table exists in the current database? I checked the documentation, and couldn't find anything (but maybe I missed it). Glen - Before posting, please check: http://www.mysq