Subject | Re: A query about foreign keys |
---|---|
Author | Marco Aurelio Castro |
Post date | 2012-01-12T11:30:33Z |
Thanks Milan,
So the query is:
Select rc.rdb$Constraint_Name Constraint_Name, rc.rdb$Relation_Name
From_Table, ins.rdb$Field_Name From_Field,
rc1.rdb$Relation_Name To_Table, ins1.rdb$Field_Name To_Field
From RDB$RELATION_CONSTRAINTS rc left outer join RDB$INDICES ind on
rc.rdb$Index_Name = ind.rdb$Index_Name
left outer join RDB$INDEX_SEGMENTS ins on rc.rdb$Index_Name =
ins.rdb$Index_Name
left outer join RDB$RELATION_CONSTRAINTS rc1 on ind.rdb$Foreign_Key =
rc1.rdb$Index_Name
left outer join RDB$INDEX_SEGMENTS ins1 on rc1.rdb$Index_Name =
ins1.rdb$Index_Name
Where rc.rdb$Constraint_Name = 'Foreign to search'
Marco Aurélio Castro
Director
McSoft
[Non-text portions of this message have been removed]
So the query is:
Select rc.rdb$Constraint_Name Constraint_Name, rc.rdb$Relation_Name
From_Table, ins.rdb$Field_Name From_Field,
rc1.rdb$Relation_Name To_Table, ins1.rdb$Field_Name To_Field
From RDB$RELATION_CONSTRAINTS rc left outer join RDB$INDICES ind on
rc.rdb$Index_Name = ind.rdb$Index_Name
left outer join RDB$INDEX_SEGMENTS ins on rc.rdb$Index_Name =
ins.rdb$Index_Name
left outer join RDB$RELATION_CONSTRAINTS rc1 on ind.rdb$Foreign_Key =
rc1.rdb$Index_Name
left outer join RDB$INDEX_SEGMENTS ins1 on rc1.rdb$Index_Name =
ins1.rdb$Index_Name
Where rc.rdb$Constraint_Name = 'Foreign to search'
Marco Aurélio Castro
Director
McSoft
[Non-text portions of this message have been removed]