Proxy > Gmail Facebook Yahoo!

Find Parent table of any child table

select * from (
Select object_name(rkeyid) Parent_Table,object_name(fkeyid) Child_Table,object_name(constid) FKey_Name, FKey_Col, Ref_KeyCol
sys.sysforeignkeys s

Inner join sys.syscolumns c1
on ( s.fkeyid = And s.fkey = c1.colid )
Inner join syscolumns c2
on ( s.rkeyid = And s.rkey = c2.colid )

) t where child_table like '%<<ChildtableName>>%'
Order by Parent_Table,Child_Table


0 Respones to "Find Parent table of any child table"

Send mail to your Friends.  

Expert Feed

Return to top of page Copyright © 2011 | My Code Logic Designed by Suneel Kumar