DECLARE @OnlineRegTokenPerDay INT
SET @OnlineRegTokenPerDay=10
declare @dteStart date
declare @dteEnd date
declare @dtStart smalldatetime
declare @dtEnd smalldatetime
Select @dteStart = GETDATE()+2
Select @dteEnd = GETDATE()+20
CREATE TABLE #working_hours (FullDates SMALLDATETIME);
while @dteStart <= @dteEnd
BEGIN
print @dteStart
IF datename(WEEKDAY, @dteStart) <> 'Saturday'
AND DATENAME(WEEKDAY, @dteStart) <> 'Sunday'
AND @dteStart not in ('2019-01-14','2019-01-26')--any special date of holiday
BEGIN
SET @dtStart=@dteStart
insert into #working_hours values (@dtStart)
END
Select @dteStart = DATEADD(day,1,@dteStart)
END
Select * From #working_hours