I am implementing my first dimensional model for a first-time data warehouse effort. We're using SQL Server 2005. Here is my initial attempt at defining a date dimension table with all the "usual" attributes, i.e.,
I have read that I could first turn the identity off and insert "pseudo-date" records with, perhaps, negative key values to represent situations such as future, n/a, unknown, etc.
I assume it's a good idea to have non-null attributes in dimension tables.
I could probably enter "Unknown" or "N/A", etc. in the FullDate field (which usually holds, e.g., July 4, 2006). and come up with reasonable defaults for most of the others.
My concern is the actual date field (the datetime one). Do I create bogus dates for this field? Like '12/31/2999' for "future"?
Any and all suggestions, opinions will be most welcome.
Code:
CREATE TABLE [dbo].[DimDate] (
[DateKey] [int] IDENTITY (1, 1),
[Date] [datetime] ,
[FullDate] [varchar] (30) ,
[DayOfWeek] [varchar] (20) ,
[DayInMonth] [tinyint] ,
[DayInYear] [smallint] ,
[IsLastDayOfWeek] [bit] ,
[IsLastDayOfMonth] [bit] ,
[CalendarWeekEndDate] [datetime] ,
[CalendarWeekInYear] [tinyint] ,
[CalendarMonthName] [varchar] (30) ,
[CalendarMonthInYear] [tinyint] ,
[CalendarMonthYear] [varchar] (35) ,
[CalendarYearMonth] [char] (7) ,
[CalendarQuarter] [char] (2) ,
[CalendarYearQuarter] [char] (7) ,
[CalendarYear] [char] (4) ,
[WeekdayIndicator] [varchar] (30) ,
[HolidayIndicator] [varchar] (30) ,
CONSTRAINT [PK_DimDate] PRIMARY KEY NONCLUSTERED
(
[DateKey]
)
) GO
I have read that I could first turn the identity off and insert "pseudo-date" records with, perhaps, negative key values to represent situations such as future, n/a, unknown, etc.
I assume it's a good idea to have non-null attributes in dimension tables.
I could probably enter "Unknown" or "N/A", etc. in the FullDate field (which usually holds, e.g., July 4, 2006). and come up with reasonable defaults for most of the others.
My concern is the actual date field (the datetime one). Do I create bogus dates for this field? Like '12/31/2999' for "future"?
Any and all suggestions, opinions will be most welcome.