1
Hello. I need to make a query to the system tables, which return me 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 compose it and for each field, Field_source and Field_type.
I’m 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.
Is it wonderful to point out the error in the above command, or to correct it? Thank you.
Thanks Cava. It worked perfect!
– Rapha43