SQL RENAME TABLE command

Posted by Nano HE on Stack Overflow See other posts from Stack Overflow or by Nano HE
Published on 2010-04-15T13:05:55Z Indexed on 2010/04/15 13:23 UTC
Read the original article Hit count: 565

Filed under:
|
|
|

Hello. I can run RENAME TABLE student TO student_new ;
The command is same and easy to follow.

Is there a methods to rename a lot of tables in simple command. Assume all the tables belog to the same DB name.

I don't need write a lot of code as below?

RENAME TALBE pre_access TO pre_new_access; 
RENAME TALBE pre_activities TO pre_new_activities;
RENAME TALBE pre_activityapplies TO pre_new_activityapplies;
RENAME TALBE pre_adminactions TO pre_new_adminactions;
RENAME TALBE pre_admincustom TO pre_new_admincustom;
RENAME TALBE pre_admingroups TO pre_new_admingroups;
RENAME TALBE pre_adminnotes TO pre_new_adminnotes;
...

(there are still so many tables need to be renamed)

© Stack Overflow or respective owner

Related posts about sql

Related posts about command