From: Peter Brawley Date: October 6 2005 4:10pm Subject: Re: Detect if table exists from within MySQL? List-Archive: http://lists.mysql.com/mysql/190049 Message-Id: <43454C71.2010504@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 'SHOW COLUMNS FROM tablename' returns error 1146 (42S02), the table doesn't exist. PB 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 them. Here is how it was done in MSSQL: > >IF OBJECT_ID('cfgbiz') IS NOT NULL > SELECT notifyto FROM cfgbiz >ELSE > SELECT '' as notifyto > >Is there something similar in MySQL? I am running version 4.1.x. > >Thanks, >-Ryan > > > > -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.11/121 - Release Date: 10/6/2005