List all unused domains for a Firebird database

落花浮王杯 提交于 2019-12-04 23:48:11

问题


Is there a quick way to list all Firebird domains defined for a database that are actually not used by any field ? I have a large database with many tables and many domains and it seems that a lot of them are not anymore used, so I guess it's time for a cleanup !

I think this is possible by querying the RDB$... system tables, but I'm unsure how to do this.


回答1:


SELECT
  f.rdb$field_name
FROM
  rdb$fields f
  LEFT JOIN rdb$relation_fields rf
    ON rf.rdb$field_source = f.rdb$field_name
WHERE
  rf.rdb$field_name IS NULL
  AND
  COALESCE(f.rdb$system_flag, 0) = 0


来源:https://stackoverflow.com/questions/35432357/list-all-unused-domains-for-a-firebird-database

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!