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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select Date Ranges by Work Week

Author  Topic 

ddobbertin
Yak Posting Veteran

51 Posts

Posted - 2005-12-09 : 11:59:27
Was wondering if anyone had any ideas for querying a date range by work week? For example I am trying to display two pull down menues on a webpage that show the previous month and the current months dates. This issue I am having is displaying the previous month. November 2005 started on a Tuesday so in my select box I need to include October 31st to complete the first work week of November. Any help would be appreicated.

druer
Constraint Violating Yak Guru

314 Posts

Posted - 2005-12-09 : 13:06:42
So the idea is that you want all of the workday weeks for the month prior to whatever today is?
Go to Top of Page

ddobbertin
Yak Posting Veteran

51 Posts

Posted - 2005-12-09 : 14:05:34
Yes. The webpage is for report generation. The user selects a date range from two drop boxes, one is the start date the other is an end date. I want all of the dates populated in those boxes to be from the last month and the current month. I am just having trouble querying the recordsets to say include dates by work week. For example the first work week of this past November started with Monday October 31st and ended with Friday November 4th.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2005-12-09 : 14:14:49
The function in this link will return the first day of the week for any date you pass to it. If you pass it the first day of last month, it will return the start of the week.

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47307





CODO ERGO SUM
Go to Top of Page

ddobbertin
Yak Posting Veteran

51 Posts

Posted - 2005-12-09 : 15:35:10
Thanks for the help...I was able to use the function within a DTS package and get the dates I need. Excellent help!
Go to Top of Page
   

- Advertisement -