views:

122

answers:

2

I need to split a report by work week, and our work week is Saturday through Friday. How would I convert an ISO week from DATEPART(WW, ) into a work week?

+4  A: 

Use SET DATEFIRST to be saturday:

SET DATEFIRST 6;

Check the DATEPART documentation regarding the ISO week for how this affects things.

OMG Ponies
Yep this was the problem. I removed datefirst because it made another function come out correct that was actually incorrectly written. The other function came out wrong because while in development I forgot to set datefirst on it and instead corrected it with increments, but my DbConnection in my app WAS setting datefirst so it came out wrong.Basically I was a dummy, and the program is working in both functions instead of me swapping logic errors between them.
jjacksonRIAB
+1  A: 

SET DATEFIRST 6

Mike