Last active
August 29, 2015 14:10
-
-
Save NeMO84/d5e297348339564fa59e to your computer and use it in GitHub Desktop.
Convert collation for multiple tables easily
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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