By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,379 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,379 IT Pros & Developers. It's quick & easy.

getting tables that link to a table

P: n/a

How can I run a query to figure out what tables and corresponding
columns link to any column in my table T?

Thanks, - Dave
Apr 2 '08 #1
Share this Question
Share on Google+
1 Reply

P: n/a

SELECT AS ChildTable, AS ChildColumn, AS
ParentTable, AS ParentColumn
FROM sysforeignkeys fk
JOIN syscolumns col on fk.fkeyid and col.colid= fk.fkey
JOIN syscolumns col2 on and col2.colid= fk.rkey
JOIN sysobjects obj on
JOIN sysobjects obj2 on

This will give you all of the foreign key relationships. Add a WHERE
clause to narrow it down to one table.

Bill E.
Hollywood, FL

Apr 2 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.