Skip navigation links

MySQL Forums :: Data Dictionary & Information Schema :: Check if a table exists


Advanced Search

Re: Check if a table exists
Posted by: Bob Field ()
Date: August 27, 2006 09:17AM

I'm not sure what an Advantage database is, but you can query the INFORMATION_SCHEMA `tables` system view which returns a list of all tables on the server instance. You can narrow the select by specifying table_schema or table_name in your WHERE clause. There's any number of ways to code this statement. Here is one example:
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'databasename'
AND table_name = 'tablename';
If no rows are returned, the table does not exist.

Options: ReplyQuote


Subject Views Written By Posted
Check if a table exists 129026 Alexandre Lu 08/24/2006 09:12AM
Re: Check if a table exists 69720 Bob Field 08/27/2006 09:17AM
Re: Check if a table exists 44226 marc castrovinci 09/06/2006 12:36PM
Re: Check if a table exists 40937 Ekta Sharma 11/12/2006 11:44PM
Re: Check if a table exists 40524 Bob Field 11/13/2006 09:05AM
Re: Check if a table exists 45851 kamiar kanani 01/11/2007 09:17AM
Re: Check if a table exists --> here is a function to use. 33805 jeff maass 07/19/2008 05:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.