THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Browse by Tags

All Tags » Transact SQL » Business rules   (RSS)
  • Saving the whole team of players or nothing

    Suppose that you need to store teams of players, and you must enforce the following business rule: each team must consist of exactly two players. I will demonstrate how you can use constraints to implement this rule. I haven't used this approach in production yet, but I wanted to share an interesting idea. Of course we typically use triggers or ...
    Posted to Alexander Kuznetsov (Weblog) by Alexander Kuznetsov on July 15, 2009
  • Two suggestions to enhance constraints in SQL Server

    We can tuck any logical expressions in CHECK constraints, but all foreign keys are currently capable of right now is to verify that one or more column values are equal. In many cases it would be very useful to have foreign keys use more complex logical expressions. Also in some cases the ability to create constraints on indexed views would ...
    Posted to Alexander Kuznetsov (Weblog) by Alexander Kuznetsov on May 4, 2009
  • Using ROWVERSION to enforce business rules

    Suppose that you need to enforce the following business rule: contracts cannot be changed after you have started working on them (let us assume that that particular business operates in the perfect world).  You can use a ROWVERSION column, a persisted computed one, and a foreign key constraint to implement this rule, and I ...
    Posted to Alexander Kuznetsov (Weblog) by Alexander Kuznetsov on April 28, 2009
Privacy Statement