Last active
February 18, 2019 11:20
-
-
Save prathik/ec611263111bf9e3dce5df967b7a4715 to your computer and use it in GitHub Desktop.
Mysql Query to generate TRUNCATE TABLE command for all tables in given databases
This file contains hidden or 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
SELECT | |
GROUP_Concat(CONCAT('TRUNCATE TABLE ', | |
table_schema, | |
'.', | |
TABLE_NAME) SEPARATOR '; ' ) | |
FROM | |
INFORMATION_SCHEMA.TABLES | |
where | |
table_schema in ( | |
'db1', 'db2' | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment