SQL Query to get the table names which use a particular column as a foriegn key
- by vinayvasyani
What sql query would you write to get the table names which have a particular foriegn key.
Eg. Person_Table(person_id,name,address,...)
Purchases_Table(purchaseid, purchased_by_id(fkey)....)
AccountDetails_Table(AccountId,PersonID,....)
Roles_Table(PersonId,RoleID)
Now i want to find the table names where Person id is used as a foreign key.
The above schema would return me
Purchases_Table,AccountDetails_Table, Roles_Table
Database: SQL Server