如何暂时禁用 Firebird 2.1 中表中的所有约束?

发布于 2024-07-26 15:59:50 字数 87 浏览 4 评论 0原文

我想禁用所有外键约束并在之后重新启用它们,有什么办法可以做到这一点吗?

我知道 SQLServer 允许这样做,但是 Firebird 呢?

I want to disable all Foreign key constraints and re-enable them after, is there some way to do that?

I know that SQLServer allows that, but what about Firebird?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

少女的英雄梦 2024-08-02 15:59:50

在 Firebird 2.1 及以下版本中无法禁用 AFAICT 外键。
您必须删除并重新创建它们。
有一个类似的线程在德夫谢德。

AFAICT foreign keys can't be disabled in Firebird up to 2.1.
You'd have to drop and recreate them.
There's a similar thread on Devshed.

伤感在游骋 2024-08-02 15:59:50

我想唯一的方法是删除它们然后重新创建它们。 由于约束不是数据,因此您实际上不会丢失数据库中的任何信息,因此这是一个无害的操作(前提是您保留脚本以便稍后重新创建它们)。

SVN 存储库中的 FlameRobin 版本可以选择为所选表列依赖项自动生成这些 DROP 和 CREATE 脚本。 上一个正式版本对整个表具有相同的选项,因此这可能会对您有所帮助。 但是,没有选项可以对整个数据库执行此操作。 也许是其他管理员。 工具有这个功能。

I guess the only way is to drop and later re-create them. Since constraints are not data, you really do not lose any information from the database, so it is a harmless operation (provided that you keep the script to recreate them later).

Version of FlameRobin in SVN repository has an option to generate those DROP and CREATE scripts automatically for chosen table column dependencies. Last official release has the same option for entire tables, so that might help you. There is no option to do it for the whole database, though. Maybe some other admin. tool has that feature.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文