Archive for June 30th, 2011
Answering questions asked on the site.
… I’ve always thought
UNPIVOTare signs of a poorly designed database. I mean, is there a legitimate use for them if your model is OK?
I’ve made an actual use for them in a project I’ve been working on for the last several months (which is partly why there were no updates for so long!)
Part of the project is a task management system where each task has several persons related to it. There can be the creator of the task, the person the task is assigned to, the actual author of the task (on behalf of whom the task is created), and the task can be possible completed by a person or deleted by a person. A total of 5 fields related to persons.
Now, we need to take all tasks within a certain time range and list all people involved in them.
Let’s create a sample table and see how would we do that.