Created
September 26, 2018 09:30
-
-
Save SteGriff/e458217ba2a0f84afd1e52f04a56cd88 to your computer and use it in GitHub Desktop.
Generate DROP statements for FK constriants
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('alter table ', table_name, ' drop foreign key ', constraint_name, ';') | |
| from | |
| information_schema.key_column_usage | |
| where | |
| referenced_table_name is not null | |
| and table_schema = 'MyTableName'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment