Hello. I need to query the system tables, so I get the following result:
Relation_Name, Field_Id, Field_Name, Field_source, Field_type
for each user-defined table (Relation_Name) (except Views). That is, for each table, the fields (Field_Name) that make it up and for each field, Field_source and Field_type.
I am using the following command:
select distinct
RelFields.RDB$Relation_Name as "Rel Name",
RelFields.RDB$Field_Id as "Field Id",
RelFields.RDB$Field_Name as "Field Name",
RelFields.RDB$Field_Source as "Field Source",
Fields.RDB$Field_Type as "Field type"
from
RDB$Relations as Relations,
RDB$Relation_Fields as RelFields
join
RDB$Fields as Fields
on (Fields .RDB$Field_Name = RelFields.RDB$Field_Name)
where
Relations.RDB$Relation_Type = '0' and
Relations.RDB$Relation_Name = RelFields.RDB$Relation_Name and
substring (Relations.RDB$Relation_Name from 1 for 4) <> 'IBE$' and
Relations.RDB$System_Flag = '0'
order by
RelFields.RDB$Relation_Name,
RelFields.RDB$Field_Name
but some Field_Names are omitted randomly for certain tables.
Would anyone point me to point the error in the above command, or else fix it? Thankful.