• L' Eomot Inversé (4/25/2013)


    But I have a minor quibble: if this is a business rule, it should be enforced by the schema if possible, not by code; and this is a classic example of a rule that can be enforced by a check constraint.

    For a production implementation, I fully agree that a trigger, even a well-coded one, would be a terrible way to implement this rule.

    But for a QotD about triggers, using a CHECK constraint would not have been a very smart choice! 😉


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/