Skip to content

Instantly share code, notes, and snippets.

@felipefinhane
Last active October 3, 2017 19:33
Show Gist options
  • Save felipefinhane/964acab15244bec0782623078fc29bf5 to your computer and use it in GitHub Desktop.
Save felipefinhane/964acab15244bec0782623078fc29bf5 to your computer and use it in GitHub Desktop.
use INFORMATION_SCHEMA;
SELECT
TABLE_NAME,
COLUMN_NAME,
CONSTRAINT_NAME,
REFERENCED_TABLE_NAME,
REFERENCED_COLUMN_NAME
FROM
KEY_COLUMN_USAGE
WHERE
-- PESQUISAR PELO NOME DA FK
CONSTRAINT_NAME LIKE "%pagamento%"
-- PESQUISAR PELA TABELA REFERENCIADA
-- REFERENCED_TABLE_NAME = 'nomeDaTabelaPai';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment