SQL Server中的可延迟约束 [英] Deferrable Constraints in SQL Server

查看:267
本文介绍了SQL Server中的可延迟约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何版本的SQL Server支持延迟约束(DC)吗?

Do any versions of SQL Server support deferrable constraints (DC)?

从版本8.0开始, Oracle支持可延迟约束 - 仅在提交语句组时才评估的约束,而不是在插入或更新单个表时进行评估。可延迟约束不同于刚刚禁用/启用约束,因为约束仍然有效 - 它们只是稍后(批量提交时)进行评估。

Since about version 8.0, Oracle has supported deferrable constraints - constraints that are only evaluated when you commit a statement group, not when you insert or update individual tables. Deferrable constraints differ from just disabling/enabling constraints, in that the constraints are still active - they are just evaluated later (when the batch is committed).

是它们允许单独地被评估为非法的更新,其累积地导致有效的结束状态。例如,在两行之间的表中创建循环引用,其中每行都需要一个值。没有单独的插入语句将通过约束 - 但是组可以。

The benefit of DC is that they allow updates that individually would be illegal to be evaluated that cummulatively result in a valid end state. An example is creating circular references in a table between two rows where each row requires a value to exist. No individual insert statement would pass the constraint - but the group can.

为了阐明我的目标,我希望将C#中的ORM实现移植到SQLServer - 依赖于Oracle DC避免在行之间计算插入/更新/删除顺序。

To clarify my goal, I am looking to port an ORM implementation in C# to SQLServer - unfortunately the implementation relies on Oracle DC to avoid computing insert/update/delete orders amongst rows.

推荐答案

到目前为止SQL Server不支持它们。你解决的问题是什么?

So far SQL Server does not support them. What is the problem you are solving?

这篇关于SQL Server中的可延迟约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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