Professional Web Applications Themes

dumping SHOW TABLES to a variable? - MySQL

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?...

  1. #1

    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?

    yawnmoth Guest

  2. #2

    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:
    [url]http://dev.mysql.com/doc/refman/5.0/en/information-schema.html[/url]

    and an introductory article:
    [url]http://dev.mysql.com/tech-resources/articles/mysql-datadictionary.html[/url]

    ciao
    gmax

    --
    _ _ _ _
    (_|| | |(_|>< The Data Charmer
    _|
    [url]http://datacharmer.blogspot.com/[/url]
    Giuseppe Maxia Guest

Similar Threads

  1. Tables don't show in Design View
    By pwalters in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: January 23rd, 05:00 PM
  2. Dreamweaver connects to DB but doesn't show tables
    By RTMac in forum Dreamweaver AppDev
    Replies: 0
    Last Post: April 12th, 04:49 PM
  3. No tables show up under databases/connections
    By Sunder27 in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 1
    Last Post: March 24th, 03:52 AM
  4. Problem with Show tables; :(
    By Adrian Majchrzak in forum PHP Development
    Replies: 2
    Last Post: January 14th, 10:35 PM
  5. SHOW TABLES and related options for SQL are not working
    By Ramakrishna in forum PERL Beginners
    Replies: 0
    Last Post: October 14th, 09:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139