Declare @adddate datetime,@numDays int,@no int
set @adddate=GETDATE() --- no of day to add in this date
Set @no=1
Set @numDays=5 -- no of day to add
while(@no<=@numDays)
begin
SET @addDate = DATEADD(d, 1, @addDate)
IF DATENAME(DW, @addDate) = 'sunday' SET @addDate = DATEADD(d, 1, @addDate)
IF DATENAME(DW, @addDate) = 'saturday' SET
@addDate = DATEADD(d, 2, @addDate)
--print @addDate
set @no=@no+1
end
print @adddate
No comments:
Post a Comment
Note: only a member of this blog may post a comment.