Find all Foreign Key / Primary Key relationships in a DB in MS SQL Server

I was looking for a way to find all the foreign keys to a primary key in a certain table in a certain database today at work.  A co-worker of mine found this link:

http://sqlserver2000.databases.aspfaq.com/schema-how-do-i-find-all-the-foreign-keys-in-a-database.html

It gives a script to use on the database that finds all the primary/foreign key relationships in the database.  You can limit it to just a particular table in the WHERE clause.

This is very useful!

No comments yet.