Re: OT: deleting tables from mysql using wildcard
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Kent West wrote:
> I have a lot of tables in a mysql database starting with "phpWeb"; I
> want to delete them. I can delete them one-by-one with a command like:
>
> drop table phpWebmod_modules;
>
> Rather than trying to delete all 20-30 similar tables, a wildcard
> command would be really nice hear. I've been googling for the last
> couple of hours, and haven't found the solution. Yes, I've tried * and %
> and putting the names in single-quotes, as in
>
> drop table phpWeb%
> drop table phpWeb*
> drop table 'phpWeb*'
> drop table 'phpWeb%'
Are there compound statements in MySQL?
for :x as each row of
select table_name
from syscatalog
where sysrelation starting with 'phpWeb'
do
drop table :x.table_name cascade;
end for;
- --
Ron Johnson, Jr.
Jefferson LA USA
Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEj5zWS9HxQb37XmcRAjsIAJ46ubtPlKaBQ9sCFYJOQMJaNNbg1ACeNujW
YlAEokfuiXdDZomChYbBPIg=
=ex1G
-----END PGP SIGNATURE-----
Reply to: