SQL how do you query for tables that refer to a specific foreign key value?
I have table A with a primary key on column ID and tables B,C,D... that
have 1 or more columns with foreign key relationships to A.ID.
How do I write a query that shows me all tables that contain a specific
value (eg 17) of the primary key?
I would like to have generic sql code that can take a table name and
primary key value and display all tables that reference that specific
value via a foreign key.
The result should be a list of table names.
I am using MS SQL 2012.
No comments:
Post a Comment