PDA

View Full Version : sql query


havard20009
09-24-2009, 09:49 PM
hi guys i need sql query command in myphpadmin for change all table collection
can you help me ??
i want change all my collation table form latin1_general_ci to latin1_swedish_ci
i know how to change it
but i need sql command in myphpadmin for change all of table together.
Syntax command

Adrian Schneider
09-24-2009, 10:29 PM
You could use mysqldump to create a backup of your database, find/replace, and then re-import it.

You can also try this... run the query in phpMyAdmin, and then copy the results, and paste them into a new query. Change 'vb384' (last line) to the name of your database, and 'latin1' (3rd last line) to the name of your desired charset. You may have to click on the 'Print View' button to see the full results in phpMyAdmin.

USE information_schema;
SET SESSION group_concat_max_len = 65535;

SELECT GROUP_CONCAT(query SEPARATOR '\n') AS alterqueries
FROM ( SELECT CONCAT('ALTER TABLE ', TABLE_NAME, ' CHARSET=latin1;') AS query
FROM TABLES
WHERE TABLE_SCHEMA = 'vb384' ) AS queries;Cheers