Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Conceptual help on temporal DBs

Author  Topic 

SergioM
Posting Yak Master

170 Posts

Posted - 2014-11-02 : 23:37:58
Lets say that I'm keeping track of changes over time. I would want to have a field for the date when the row was added. Then rather than delete or update the data, I would age out the old row by adding a date to the DateExpired field and insert a new row where date expired is NULL.

This does the job, but it looks like it violates the third normal form by creating duplicate data. The only thing that makes me think otherwise is that SSIS' slowly changing dimension does it this way. Alternatively I could leave all of the non-pertinent fields as NULL and only store the actual changes. Though the querying would become much more complicated & I'm not even sure if it's technically correct.

Does anyone have thoughts on this?


ID	UserID	First	Last	Password	DateAdded	DateExpired
1 26 John Doe abc 2014-10-30 10:00:00 2014-10-31 10:00:00
2 26 John Doe def 2014-10-31 10:00:00 2014-11-01 10:00:00
3 26 John Doe ghi 2014-11-01 10:00:00 NULL




-Sergio
I use Microsoft SQL 2008

ninjadbskillznot
Starting Member

4 Posts

Posted - 2014-11-18 : 14:39:15
I'm working on stuff like this, too, although I am new at it.

Your example looks like a Type 2 SCD. You can compare it to the others here:
http://en.wikipedia.org/wiki/Slowly_changing_dimension

You can also check this page for comparison:
http://www.dwbiconcepts.com/etl/27-basic-etl-concepts/109-methods-of-incremental-loading-in-data-warehouse.html

Finally, you can check the Richard Snodgrass book on temporal databases:
http://www.cs.arizona.edu/~rts/tdbbook.pdf (Warning: largish PDF)

I think a separate history table would preserve normalization, but you have to decide what the purpose of the table(s) is - transactional or data warehouse/historical.

I'd be curious to know what you end up doing to solve this.

Best regards,
Go to Top of Page
   

- Advertisement -