Created
June 13, 2019 16:58
-
-
Save gobinathm/32df7d762eb41b7c9ab0813a5db26f53 to your computer and use it in GitHub Desktop.
Search Entire DB & Delete records on specific text
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 | |
CONCAT('delete FROM ', A.TABLE_SCHEMA, '.', A.TABLE_NAME, | |
' WHERE ', A.COLUMN_NAME, ' LIKE \'%fr%\';') | |
FROM INFORMATION_SCHEMA.COLUMNS A | |
WHERE | |
A.TABLE_SCHEMA != 'mysql' | |
AND A.TABLE_SCHEMA != 'innodb' | |
AND A.TABLE_SCHEMA != 'performance_schema' | |
AND A.TABLE_SCHEMA != 'information_schema' | |
AND ( | |
A.DATA_TYPE LIKE '%text%' | |
OR | |
A.DATA_TYPE LIKE '%char%' | |
) | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment