Rename table with a strange name

I have attempted to install an extenxion in Joomla, but there was a problem with the installation and the name of the tables are really weird. The name is like #__table1.

I have problems because of "#" character. I have tried with something like this, it doesn't work. How should I proceed?

RENAME TABLE CHAR(35) + '__table1' TO xxxxx_table1, CHAR(35) + '__table2' TO xxxxx_table2;

Upvotes: 0

Views: 29

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522741

Have you tried just using backticks:

RENAME TABLE `#__table1` to xxxxx_table1, `#__table2` to xxxxx_table2;

I did not test the RENAME command explicitly, but it seems possible to have a table name with a # sign, so long as we put backticks around the table name.

Side note, as you probably already figured out, you should avoid table and column names with strange symbols, or MySQL reserved keywords.

Upvotes: 2

Related Questions