April 3, 2008 at 8:50 am
I have the following:
datename(ww,fld_posting_date) , fld_posting_date
it produces:
102008-03-02 00:00:00.000
My issue is that the ww uses Sunday as the first day of the week and I need to change it to Monday. I need to report Monday through Sunday not Sunday through Saturday.
Thanks,
seajoker
April 3, 2008 at 8:59 am
Use the SET DATEFIRST command.
You can look it up in SQL Server Books Online.
April 3, 2008 at 9:35 am
Thank you for your help, it works like I wanted it to for my grouping.
How can I take that week ie 44,45 and change it to display a weekending date, like the Sunday date of that week?
Do I need a reference table?
Thanks
Seajoker
April 3, 2008 at 10:01 am
You should ask for what you need the first time, instead of posting a question, getting a reply, and then saying that what you really need is something else.
You can group by the end of week date just as easily as grouping by the week number.
select
END_OF_WEEK_DATE =
dateadd(dd,((datediff(dd,-53690,a.MyDate)/7)*7)+6,-53690)
from
MyTable
End of Week Function:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64760
Date/Time Info and Script Links
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply