SQL Server Performance Forum – Threads Archive
Find Relationship infoI received a large db from a client and it has lots of tables with defined relationships. When I pick the tables in the diagram they are linked for me but the columns part of the join are not shown (the "show relationship label" button does not show col names). Any option to show that info or idea on how to get to the sys table which contains that info? Thanks in advance. Stefano
Try the following script.. SELECT fk_tc.TABLE_NAME,
FROM Information_Schema.Table_Constraints as fk_tc
JOIN Information_Schema.Referential_Constraints as rc
on fk_tc.Constraint_Name = rc.Constraint_Name
JOIN Information_Schema.Table_Constraints as pk_tc
on rc.UNIQUE_CONSTRAINT_NAME = pk_tc.CONSTRAINT_NAME
SQL-Server-Performance.com All postings are provided â€œAS ISâ€ with no warranties for accuracy.
Dependancy is only area that needs lot of attention from SQL Dev. team and for granular details you might need to depend upon third party tools:http://www.apexsql.com/blog/2006/03/sql-server-2005-still-has-dependency.htm Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.
Red -Gate also has a free tool caled SQL Dependency tracker —————————————-
Contributing Editor, Writer & Forums Moderator
http://www.SQL-Server-Performance.Com Visit my Blog at