Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

Useful Dates: The Many Uses of Date Tables Expand / Collapse
Author
Message
Posted Wednesday, December 17, 2008 2:30 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, January 3, 2011 8:48 AM
Points: 26, Visits: 71
Bob Hovious (12/17/2008)
Could you give us a real world example or two using other dimensions besides day?


I have worked with large data warehouse applications that do a lot of data aggregation. The ability to roll data up into non-day increments (hours, months, quarters and years) is useful in those applications. It allows you to store the aggregated data referenced by a single time coordinate. I'm not suggesting that a set of data be linked to ALL dimensions. So you wouldn't link a record to the year 2008, Quarter 1, Month 10 and day 10 if it was 10-OCT-2008. But if you do periodical aggregation as the need for granularity decreases as data ages, the ability to use a single value to represent that can be useful.
Post #621625
Posted Wednesday, December 17, 2008 2:31 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, January 3, 2011 8:48 AM
Points: 26, Visits: 71
TheSQLGuru (12/17/2008)
It is customary and useful to have your int date keys be formatted CCYYMMDD, at least in the classical date dimension scenario. Identities are really not helpful here.


What format would you propose for the quarterly and hourly values?
Post #621629
Posted Thursday, December 18, 2008 8:20 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 12:11 PM
Points: 4,343, Visits: 6,150
I had zoned out when I posted that this date table is more granular than day.

Best,

Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru at GMail
Post #622134
Posted Monday, December 22, 2008 10:08 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 1:46 PM
Points: 3,135, Visits: 11,475
Here is another approach on the link below. Function F_TABLE_DATE is a multistatement table-valued function that returns a table containing a variety of attributes of all dates from @FIRST_DATE through @LAST_DATE. It was intended mainly to be able to load a date table, but is can also be used directly in a statement for those occasions when you want to go outside your standard ranges.

This function has about 65 columns representing just about every date attribute I have ever had any need for. It does not include any Fiscal period attributes, since that is something that is usually specific to a particular organization.


Date Table Function F_TABLE_DATE
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61519




Post #624068
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse