Home / Software / Tips and Tricks / How to find out Foreign Key and Primary Key Relationship Constraint in Database?

How to find out Foreign Key and Primary Key Relationship Constraint in Database?

Updated:  05/09/2012 12:05 PM
Author:  Shiju Mathews

Status:    Resolved.


There may be situations when there is need to find out the relationship between Primary Key and Foreign Key in a SQL database.
This can be done using the system objects sys.foreign_keys , sys.foreign_key_columns and sys.objects. The following script will give the details.