THE SQL Server Blog Spot on the Web

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

Browse by Tags

All Tags » Data Integrity » Database Programming   (RSS)
  • Storing intervals of time with no overlaps.

    I will demonstrate how use constraints to make sure that intervals of time have no overlaps. Also you may ensure that there are no gaps either, but if you choose to allow gaps, then the query to retrieve them is very easy. As discussed in my previous posts, you can also use triggers or UDFs wrapped in CHECK constraints, but only trusted ...
    Posted to Alexander Kuznetsov (Weblog) by Alexander Kuznetsov on March 8, 2009
  • Denormalizing to enforce business rules: Running Totals

    Calculating running totals is notoriously slow, whether you do it with a cursor or with a triangular join. It is very tempting to denormalize, to store running totals in a column, especially if you select it frequently. However, as usual when you denormalize, you need to guarantee the integrity of your denormalized data. Fortunately, you can ...
    Posted to Alexander Kuznetsov (Weblog) by Alexander Kuznetsov on January 23, 2009
  • Denormalizing to enforce business rules: Part 1.

    You cannot use CHECK constraints to compare columns in different rows or in different tables, unless you wrap such functionality in scalar UDFs invoked form a CHECK constraint. What if you actually need to compare columns in different rows or in different tables to enforce a business rule? For example, suppose that you know working hours of ...
    Posted to Alexander Kuznetsov (Weblog) by Alexander Kuznetsov on January 21, 2009
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement