SQLServer relational query based on the foreign key table

SELECT = primary key column ID b.rkey    
  , the primary key column name = (the FROM SELECT name = b.rkey the syscolumns the WHERE the colid the AND ID = b.rkeyid)    
    , the foreign key table ID = b.fkeyid    
    , foreign key table name = object_name (B. fkeyid)    
    , the foreign key column ID = b.fkey    
    , the foreign key column name = (the FROM the SELECT name = b.fkey the syscolumns the WHERE the colid the AND ID = b.fkeyid)    
    , cascading updates = ObjectProperty (a.id, ' CnstIsUpdateCascade ' )    
    , cascading deletes = ObjectProperty (a.id, ' CnstIsDeleteCascade ' )    
the FROM A the sysobjects    
    the Join SYSFOREIGNKEYS ON a.id B =b.constid   
    join sysobjects c on a.parent_obj=c.id   
where a.xtype='f' AND c.xtype='U'   
    and object_name(b.rkeyid)='TABLE_PMD_TPP_TRAITS'

 

Guess you like

Origin www.cnblogs.com/xtjatswc/p/12165912.html