[TriLUG] mysql syntax for ambiguous file name, please

Brian McCullough bdmc at bdmcc-us.com
Sat Jun 16 18:15:06 EDT 2007


On Sat, Jun 16, 2007 at 05:32:16PM -0400, Brian McCullough wrote:
> On Sat, Jun 16, 2007 at 05:05:28PM -0400, Michael Rulison wrote:
> > I want to do the following query, but it fails:
> > 
> > alter table jos_* rename to j_fca_*;
> > 
> > but the '*' is not accepted (inside, outside of quotes (double or single);
> 
> The wild card match character in SQL is "%".  

> Most RDBMS ( database engines ) do not allow wild cards in Data
> Definition statements.


Found what I was looking for.  The syntax for the ALTER TABLE and RENAME
TABLE statements are very explicit about having single table names on
both the left and right hand sides of those statements.


About the only way that I can see to do what you are trying would be to
use SELECT to create a list of the table names that you wanted to
change, in a text file.  Then you could edit that list by creating a
RENAME TABLE statement out of the list, adding the changed names.  I
would then submit that new statement to MySQL for execution.

( That's a rather abbreviated description of the work that would be
needed.  Let me know if you need examples. )


Brian





More information about the TriLUG mailing list