dumping SHOW TABLES to a variable?

This is a discussion on dumping SHOW TABLES to a variable? within the MySQL Database forums, part of the Database Forums category; I'd like to store the results of SHOW TABLES in a variable @a and then be able to do ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-09-2006
yawnmoth
 
Posts: n/a
Default dumping SHOW TABLES to a variable?

I'd like to store the results of SHOW TABLES in a variable @a and then
be able to do somethng like DROP TABLE @a. (ie. I'd like to be able to
delete all tables matching a specified pattern).

Is it possible without having to use some external programming language
construct?

Reply With Quote
  #2 (permalink)  
Old 05-09-2006
Giuseppe Maxia
 
Posts: n/a
Default Re: dumping SHOW TABLES to a variable?

yawnmoth wrote:
> I'd like to store the results of SHOW TABLES in a variable @a and then
> be able to do somethng like DROP TABLE @a. (ie. I'd like to be able to
> delete all tables matching a specified pattern).
>
> Is it possible without having to use some external programming language
> construct?
>


Unfortunately, you can't.
If you are using MySQL 5.0 or later, you can get information about tables (and
many other things from the INFORMATION_SCHEMA)

For example, the equivalent of SHOW TABLES is

SELECT table_name from INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='database_name';

See the manual:
http://dev.mysql.com/doc/refman/5.0/...on-schema.html

and an introductory article:
http://dev.mysql.com/tech-resources/...ictionary.html

ciao
gmax

--
_ _ _ _
(_|| | |(_|>< The Data Charmer
_|
http://datacharmer.blogspot.com/
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:28 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0