MySQL Forums
Forum List  »  Newbie

Re: drop table like
Posted by: Chris Stubben
Date: June 08, 2005 01:59PM

Hi,

You can use

show tables like 'tmp%';
+-----------------------+
| Tables_in_test (tmp%) |
+-----------------------+
| tmp1 |
| tmp2 |
| tmp3 |
+-----------------------+

AND

drop table tmp1, tmp2, tmp3;

---

I sometimes combine the two in a shell script. Be careful.


mysql -N -e "show tables like 'tmp%'" test | perl -e 'while(<>){chomp; push @tables, $_;}print "drop table " . join ("," ,@tables) . "\n";' | mysql test


Chris

Options: ReplyQuote


Subject
Written By
Posted
June 06, 2005 09:03AM
June 08, 2005 09:36AM
June 08, 2005 11:04AM
Re: drop table like
June 08, 2005 01:59PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.