example
exec usp_first_day_and_last_day_of_week 2015,42
result
example
exec usp_first_day_and_last_day_of_week 2015,42
result
create procedure usp_first_day_and_last_day_of_week(@y as int,@w as int) as begin --Kamel Gazzah 12/10/2015 --kamelgazzah@gmail.com declare @fd as datetime set @fd='01/01/'+convert(varchar(4),@y) select @w "week",dateadd(day,8+7*(@w-2)-datepart(weekday,@fd),@fd)"first day",dateadd(day,14+7*(@w-2)-datepart(weekday,@fd),@fd)"last day" end