I have a table as follows,
here I want to re-generate the StartDate and EndDate data based on the NumberOfDaystoAdd values, and the StartDate for subsequent rows based on previous row's EndDate + 1day and in this sequence I need to exclude the weekend dates.
For Example, Here the 1st row values correct, second row startdate should be 2021-03-28 and EndDate should be 2021-03-10.
I want to apply the logic and select the data in same select query using sql server.
Expected result as follows,
Example data: