TblDates WTF?



  • I've come across a few WTFs befor at various jobs (everyone sees them and most of us have probably created a few), but I discovered the biggest one today.

    I was looking at a table which had a date field, simple enough right? Apparently not, the date field wasn't a date but a reference to tblDates which contains an id and and a date for every day through to 20XX. So in 20XX we get to recieve the classic tech support call of "can you add more numbers to the database?"

    The only possible reasoning I can see behind this was that the database designer thought that dates were stored as strings and therfore it used less space to store them all in one table. But as I see DateTime (MSSQL) uses 8 bytes so I asume SmallDateTime uses 4 bytes, this means that the worste case scenario 1 entry per date would have used 4 bytes, now it uses 12, requires an inner join and added complexity.

    Apparently someone from the company will be getting in contact with the ex employee soon so I'm interested to here the reasoning behind this.

    Can anyone think of a more logical explaination?



  • @flukus said:

    Can anyone think of a more logical explaination?

    It's normalisation gone mad.  Mad, I tell you!

    Simon



  • Makes it easy to swap dates. Let's say someone decides "everything that happened last saturduay shall have happend yesterday", now you just change the two entries in tblDates and voila it's done. But then again, that's a stupid idea anyway. ;-)

    Really, some people don't know when to stop with normalization. The same kind of mind that creates a "inc" function to avoid using the ++ operator twice in a program, since they think this is too much redundancy.



  • ♿ (Parody)

    This is not normalization. This is incompetence.

    Then again, we can pretty much gather that much from the name "tblDates"

     



  • Maybe a way of data validation?


Log in to reply