List:General Discussion« Previous MessageNext Message »
From:Ryan Stille Date:October 6 2005 6:12pm
Subject:RE: Detect if table exists from within MySQL?
View as plain text  
> 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,'') FROM cfgbiz;

But it looks like the SHOW TABLES statement just doesn't return like a
regular SELECT statement does, because the above works if I use it like
this:

select IF(1,notifyto,'') FROM cfgbiz;

-Ryan
Thread
Detect if table exists from within MySQL?Ryan Stille6 Oct
  • Re: Detect if table exists from within MySQL?Peter Brawley6 Oct
  • A question about stored proceduresLeonardo Javier BelĂ©n6 Oct
    • Re: A question about stored proceduresGleb Paharenko7 Oct
  • Re: Detect if table exists from within MySQL?Jeff Smelser6 Oct
RE: Detect if table exists from within MySQL?Ryan Stille6 Oct
  • Re: Detect if table exists from within MySQL?Keith Ivey6 Oct
RE: A question about stored proceduresSujay Koduri6 Oct
RE: Detect if table exists from within MySQL?Ryan Stille6 Oct