列出Firebird数据库的所有未使用域 [英] List all unused domains for a Firebird database

查看:70
本文介绍了列出Firebird数据库的所有未使用域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种快速的方法来列出为数据库定义的所有字段实际上都没有使用的Firebird域?我有一个包含许多表和多个域的大型数据库,似乎其中许多不再使用了,所以我想是时候进行清理了!

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 !

我认为可以通过查询RDB$...系统表来做到这一点,但是我不确定如何做到这一点.

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

推荐答案

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

这篇关于列出Firebird数据库的所有未使用域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆