OneSKILL Posted February 18, 2009 Report Share Posted February 18, 2009 (edited) Piemēram man ir datubāzē tabulas(kādas 200) Kāds būtu query's lai nomainītu viņas visas, kuras sākums ir ibf_? Edited February 18, 2009 by OneSKILL Link to comment Share on other sites More sharing options...
worm Posted February 18, 2009 Report Share Posted February 18, 2009 tev vajadzēs to darīt ar kaut kādu skriptu caur php... no sākuma taisi query SHOW TABLES, pēctam RENAME TABLE vecais_nosaukums TO jaunais_nosaukums Link to comment Share on other sites More sharing options...
Gints Plivna Posted February 23, 2009 Report Share Posted February 23, 2009 Vai MySQL command line klientā vai jebkādā citā admin rīkā lietot sql, lai ģenerētu sql Piemēram, lai novāktu nost to "ibf_": mysql> use test; Database changed mysql> create table ibf_blah (a integer); Query OK, 0 rows affected (0.22 sec) mysql> create table ibf_blahdabadah (a integer); Query OK, 0 rows affected (0.03 sec) mysql> select concat('rename table ', -> table_name, -> ' to ', -> substr(table_name, 5), -> ';') ren_table -> from information_schema.tables -> where lower(table_name) like 'ibf%' -> and table_schema = 'test'; +----------------------------------------------+ | ren_table | +----------------------------------------------+ | rename table ibf_blah to blah; | | rename table ibf_blahdabadah to blahdabadah; | +----------------------------------------------+ Tagad tikai atliek rezultātu iedabūt failā un failu palaist. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now