Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Getting Table Dependencies?

Author  Topic 

toddhd
Yak Posting Veteran

55 Posts

Posted - 2005-07-15 : 17:09:29
I would like to be able to retrieve a list of tables that a given table depends on.

I tried sp_depends, but that only seems to list the stored procs and such (or vice-versa), but doesn't list the other tables that a given table depends on.

sp_help does, in a round-about way, show you these dependencies, but I am trying to get this info from a program, and I need a more concise and standard way to get the info.

I figure there is like a sproc or command which can do this, and I'm just not locating it...

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-07-15 : 18:20:18
Maybe this can get You started:

SELECT OBJECT_NAME(fkeyid) AS Parent, OBJECT_NAME(rkeyid) AS Child
FROM sysreferences ORDER BY 1,2

rockmoose
Go to Top of Page
   

- Advertisement -