You can use the function in this topic, which will allow you to select any day of week you want as the start of the week.http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47307It is also easy to compute it directly. This code show how to do it for any day of the week you want as the start of the week.select DATE, Week_Starting_Sun = dateadd(dd,(datediff(dd,-53684,a.DATE)/7)*7,-53684), Week_Starting_Mon = dateadd(dd,(datediff(dd,-53690,a.DATE)/7)*7,-53690), Week_Starting_Tue = dateadd(dd,(datediff(dd,-53689,a.DATE)/7)*7,-53689), Week_Starting_Wed = dateadd(dd,(datediff(dd,-53688,a.DATE)/7)*7,-53688), Week_Starting_Thu = dateadd(dd,(datediff(dd,-53687,a.DATE)/7)*7,-53687), Week_Starting_Fri = dateadd(dd,(datediff(dd,-53686,a.DATE)/7)*7,-53686), Week_Starting_Sat = dateadd(dd,(datediff(dd,-53685,a.DATE)/7)*7,-53685)from ( select DATE = getdate() ) a
Ths advantage of these is that they return the same result, no matter what the setting of SET DATEFIRST is. The function in the previous post, [dbo].[ufn_GetFirstDayOfWeek], will return different values for the same input date, depending on the setting of DATEFIRST.CODO ERGO SUM