Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine week by Month and Month Week
Message
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01653958
Message ID:
01654000
Views:
41
>>>
>>>I'd definitely recommend creating a date calendar table - basically one row per calendar day, with many columns to describe that day (what week, what fiscal month, what calendar month, etc.) in as many terms as the business needs...
>>
>>For me this would be additional maintenance. In my application Monday of a Month and how it relates to the Week in a Year is used quite a lot. And these values change from year to year. I prefer to have the program calculate it on-the-fly rather than having to rebuild such a table every year.
>
>Please don't take this personally - I strongly disagree. Most places create a date calendar table/date dimension and build it out a few years in advance, and many have a script to generate it. It is a superior practice.
>
>I will post some code later for an example of how to build one out. Seriously, you shouldn't have an application calculating this on the fly. There are better ways to do that.

What is a real technical reason that calculating on the fly is not as good as having a table? (aside from the fact that you don't like it :))
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform