Get First and Last day of a week

Get first and last day of a week and set monday as te first day of the week

SET DATEFIRST 1

declare @Week int  set @Week = 40
declare @Year int  set @Year = 2021

select dateadd (week, @Week, dateadd (year, @Year-1900, 0)) - 4 -
         datepart(dw, dateadd (week, @Week, dateadd (year, @Year-1900, 0)) - 4) + 1

select dateadd (week, @Week, dateadd (year, @Year-1900, 0)) - 4 -
         datepart(dw, dateadd (week, @Week, dateadd (year, @Year-1900, 0)) - 4) + 6