wvdba,
I see no reason why this couldn't be done in Access. Loading the table with initial values will be different, and the query may be slightly different, too. The concept is the important part and should work well with whatever database you choose to use.
simian336,
I've seen that page before. Mostly I like it, but there are things in there that I certainly don't like either. The biggest problem I have is with the varchar data in the table. The varchar data more than doubles the size of each row, which means you can only fit 1/2 the number of rows in each data page. This will make the table a little less efficient. Additionally, the varchar data is for monthname and weekday name. There are functions built in to SQL Server to get this information based on the date. If you allow SQL Server to do this, you can actually get the month name and weekday name with alternative languages. If you store this data in the table, you are restricted to the language you used to build the table.
Ex:
Code:
set language US_English
Select DateName(Month, GetDate()), DateName(Weekday, GetDate())
Set Language Italian
Select DateName(Month, GetDate()), DateName(Weekday, GetDate())
Set Language Spanish
Select DateName(Month, GetDate()), DateName(Weekday, GetDate())
So, you are using more space and also limiting yourself to a single language. The only possible advantage to storing this data is for filtering purposes. Ex: Select * From Calendar Where WeekdayName = 'Saturday'. If you had an index on this column, with only 7 different values, you will probably get an index scan (instead of a seek) anyway (based on the selectivity of data).
I have similar, but smaller issues with the other columns like Year, Quarter, Month & Day. All of this information can be calculated from the data (using the DatePart function).
Also consider that the table I am suggesting is very similar to a calendar table, except is also has a sequential number so it can also be used for other queries that would benefit by having a simple numbers table.
I'm rambling, forgive me. Calendar tables are nice to have. Numbers tables are nice to have. Once you have one, you'll begin to see other uses for them. I know I have.
-
George
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom