I have several tables in MS SQL that are keyed by a datetime field that contains both a date and a time and then a bunch of quantity fields. I thought these would be easy to model to a fact table with a date dimension. But since my date dim only contains dates, no times, the join never finds any matches. So according to "The Data Warehouse Lifecycle Toolkit" by Ralph Kimball on page 245 I need to split the datetime field into a date field and a time field. Then the join to the date dim will work just fine. Well, I thought that sound easy enough.
Problem 1 - Cognos does not support the convert(char(10), datetime field, 101) syntax to pull out just the date nor the similar convert(char(10), datetime field, 108) syntax to pull out just the time. To get around this I had to create a view in MS SQL with these calculated fields. Then my join to the date dim worked great.
Problem 2 - What do I do with the time field? Should it be part of the fact table as the number of seconds as Kimball suggests? Or should it become a separate time dim? My users are going to want to see things like the total quantity per hour.
So basically I'm looking to see how others have handled modeling a datetime field. Did you have to do something outside of Cognos? What did you do with the new time field?
Thanks,
Jon Mitchell
Problem 1 - Cognos does not support the convert(char(10), datetime field, 101) syntax to pull out just the date nor the similar convert(char(10), datetime field, 108) syntax to pull out just the time. To get around this I had to create a view in MS SQL with these calculated fields. Then my join to the date dim worked great.
Problem 2 - What do I do with the time field? Should it be part of the fact table as the number of seconds as Kimball suggests? Or should it become a separate time dim? My users are going to want to see things like the total quantity per hour.
So basically I'm looking to see how others have handled modeling a datetime field. Did you have to do something outside of Cognos? What did you do with the new time field?
Thanks,
Jon Mitchell