SQL CODE (Firebird/Interbase) How to get the domain from DBMS

How to get the domain from DBMS

#Used domain

select
  rdb$fields.rdb$field_name 
 from 
  rdb$fields 
  left join rdb$relation_fields 
 on (rdb$relation_fields.rdb$field_source = rdb$fields.rdb$field_name) 

 where 
 rdb$fields.rdb$system_flag = 0 
 group by 
 rdb$fields.rdb$field_name 
  having 
 count(rdb$relation_fields.rdb$field_source) > 0


#No Used domain
select
  rdb$fields.rdb$field_name 
 from 
  rdb$fields 
  left join rdb$relation_fields 
 on (rdb$relation_fields.rdb$field_source = rdb$fields.rdb$field_name) 

 where 
 rdb$fields.rdb$system_flag = 0 
 group by 
 rdb$fields.rdb$field_name 
  having 
 count(rdb$relation_fields.rdb$field_source) > 0

Comments