Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In SQLServer 2008 r2. I need to figure for a specific table what FK's in other tables point to it.

I try:


But this does not give me what I need.

Any tips?

share|improve this question
up vote 1 down vote accepted

You want to use the management views:




The latter one has column and object IDs for both sides of the constraint, so you can do a query like:

SELECT OBJECT_NAME(Constraint_object_id) as 'ConstraintTable',,
       OBJECT_NAME(Parent_object_id) 'ParentTable',
FROM Sys.foreign_key_columns fk
INNER JOIN sys.columns c1
  ON c1.column_id = fk.constraint_column_id
INNER JOIN sys.columns c2
  ON c2.column_id = fk.parent_column_id
share|improve this answer

This link is to a database reverse engineering script that I wrote a few years ago. Amongst other things it has a query that reverse engineers foreign keys. You may be able to get what you want by adapting it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.