• alen teplitsky (8/30/2010)


    i've seen this no NULL's allowed OCD thing being taken to extremes

    say you sign up a customer today and promise some service that will be done in the near future but you're not sure of the date. since the column is not null you have to put in a crazy date like 1/1/2049. or if something was done in the past then 1/1/1901

    so if a customer calls in a few days the CSR will happily tell them they can expect to see someone come to their site in 2049

    In a scenario like this, when there can be multiple reasons for a date to be NULL, I typically allow the column to be NULL, but I also have a column indicating the status of the record. For example, a sales order shipment can have a status of 'Pending' or 'Cancelled', which would explain the non-existing schedule date. I will also have a check constraint, enforcing not-NULL conditionally for specific status values. That way the application or report builders don't have to make assumptions based on the absence of information.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho