From: Jeff Smelser Date: October 6 2005 6:06pm Subject: Re: Detect if table exists from within MySQL? List-Archive: http://lists.mysql.com/mysql/190055 Message-Id: <200510061306.12585.tradergt@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1521814.lvRfeuYp0K"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart1521814.lvRfeuYp0K Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 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. 5.X has information_schema..=20 However... 4.1, you can show tables like '%tab%' and you will get a row back if exists= =2E.=20 WARNING, myisam will be quick, innodb will be really slow, specially if the= =20 tables are big..=20 Jeff --nextPart1521814.lvRfeuYp0K Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBDRWeUoOk9EvUvEtgRAgmUAKCPIV3H4oOy48uT3p5zvfFJKaie2QCgnlF3 atsZ1OpmhGGOYNm47H3D7ZY= =rNt4 -----END PGP SIGNATURE----- --nextPart1521814.lvRfeuYp0K--