mysql - How to change all table prefix in a single query -


i pretty amateur in mysql..can please tell me how can change table prefixes of whole database in single query... can manually, quite time consuming change tables prefixes. please me out. isc_administrator_log cus_administrator_log means isc_ cus_

i found these 2 solutions not understand either of them.

select  group_concat('rename table `', table_schema, '`.`', table_name, '` `',  table_schema, '`.`prefix_', table_name, '`;' separator ' ') `tables` `table_schema` = "test"; 

and

select  concat('rename table ', group_concat('`', table_schema, '`.`', table_name, '` `', table_schema, '`.`prefix_', table_name, '`')) q  `information_schema`.`tables` table_schema='test'; 

you can dynamic sql query mysql 5.0.13

 delimiter //  create procedure dynamic(in tbl char(64), in col char(64)) begin     set @s = concat('select 'rename table ',               group_concat('', table_schema, ''.'', table_name,              ' ', table_schema, ''='.prefix_''', table_name, '')) q                            information_schema.tables table_schema='test'';;'     prepare stmt @s;     execute stmt; end // delimiter ; 

got reference here


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -