Skip to content

Instantly share code, notes, and snippets.

@bindiego
Created September 19, 2014 08:05
Show Gist options
  • Save bindiego/3991c953f6bc3efb36b6 to your computer and use it in GitHub Desktop.
Save bindiego/3991c953f6bc3efb36b6 to your computer and use it in GitHub Desktop.
Get a list of all foreign key constraints pointing to a particular table, a particular column.
select
TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME
from INFORMATION_SCHEMA.KEY_COLUMN_USAGE
where
REFERENCED_TABLE_NAME = '<table>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment