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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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? |
|
|||
|
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/ |
![]() |
| Thread Tools | |
| Display Modes | |
|
|