Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
coolerbob
Aged Yak Warrior
841 Posts |
|
jhermiz
3564 Posts |
Posted - 2007-07-17 : 10:40:09
|
quote: Originally posted by coolerbob I was really pulling my hair out when I tried to make some code that would calculate the beginning of the week.Then I found this: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47307Thanks so much for posting it! I was about to give up!So this is now on my shortlist:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64762What a team!
Used it myself MVJ was nice enough to provide that..so I'm with you on the kudos and thanks to MVJ...Programmers HowTo's -- [url]http://jhermiz.googlepages.com[/url] |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-07-17 : 10:49:51
|
Glad to be of help. I’m not sure why, but the Start of Week Function is number 3 in the Script Library for number of page views. Either a lot of people need to find the start of week, or I somehow found a topic name that hit the Google sweet spot.CODO ERGO SUM |
 |
|
coolerbob
Aged Yak Warrior
841 Posts |
Posted - 2007-07-17 : 11:39:23
|
Well, I think my experience is probably repeated many times over: Financial applications (and the subsequent reporting) often want to do something like log all transactions for the week against the Monday for that week. |
 |
|
jhermiz
3564 Posts |
Posted - 2007-07-17 : 15:51:15
|
quote: Originally posted by coolerbob Well, I think my experience is probably repeated many times over: Financial applications (and the subsequent reporting) often want to do something like log all transactions for the week against the Monday for that week.
You poor soul... . Not kidding..working with the accounting folks is really difficult...you gotta be precise and have a lot of flexibility.Programmers HowTo's -- [url]http://jhermiz.googlepages.com[/url] |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-07-17 : 16:44:45
|
quote: Originally posted by jhermiz
quote: Originally posted by coolerbob Well, I think my experience is probably repeated many times over: Financial applications (and the subsequent reporting) often want to do something like log all transactions for the week against the Monday for that week.
You poor soul... . Not kidding..working with the accounting folks is really difficult...you gotta be precise and have a lot of flexibility.Programmers HowTo's -- [url]http://jhermiz.googlepages.com[/url]
Yes, and remember that when you credit an account, you are taking money out, and you debit it when you put money in.CODO ERGO SUM |
 |
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-07-17 : 16:58:41
|
quote: Originally posted by coolerbob Well, I think my experience is probably repeated many times over: Financial applications (and the subsequent reporting) often want to do something like log all transactions for the week against the Monday for that week.
Just to mention it, the function on the link below also has start of week date, end of week date, and week sequence numbers for any day of the week that you want to start the week with, as well as ISO weeks. It also has many other date attributes for years, quarters, months, days, etc. Kind of an all purpose calendar table.If you load a permanent table with the output from F_TABLE_DATE, you may find it more convenient to use for cross-tabs, especially if you have weeks where you might not have data but still need to show the week. I keep a date table loaded with the 6 prior years, the current year, and 3 future years. This seems to cover the vast majority of applications.Date Table Function F_TABLE_DATE:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61519CODO ERGO SUM |
 |
|
|
|
|
|
|