Skip to content

Instantly share code, notes, and snippets.

@NeMO84
Last active August 29, 2015 14:10
Show Gist options
  • Save NeMO84/d5e297348339564fa59e to your computer and use it in GitHub Desktop.
Save NeMO84/d5e297348339564fa59e to your computer and use it in GitHub Desktop.
Convert collation for multiple tables easily
# Original: http://stackoverflow.com/questions/10859966/how-to-convert-all-tables-in-database-to-one-collation
SELECT CONCAT("ALTER TABLE ", TABLE_NAME," COLLATE <COLLATION_VALUE>") AS ExecuteTheString
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA="<SCHEMA_NAME>"
AND TABLE_TYPE="BASE TABLE";
# Execute selected scripts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment