Skip to content
Advertisement

Deferrable Constraints in SQL Server

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

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.

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.

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement