0

I have found out how to find all dependencies on a table.

However if I just wanted to know where this primary key is used, how would I do it?

I believe we use SQL Server 2005.

1
  • 1
    What does "all dependencies" mean? Dec 1, 2016 at 11:18

1 Answer 1

1

I assume you're looking for all foreign keys that are based on a given table (and it's primary key). If you were on SQL Server 2008+ you could use sp_fkeys.

EXEC sp_fkeys 'TableName'

As you're on 2005 you'll have to put together this data manually. Check this previous answer by Gishu, it should give you the script you're after.

https://stackoverflow.com/questions/483193/how-can-i-list-all-foreign-keys-referencing-a-given-table-in-sql-server

0

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