2
Reply

How To Understand Before Next Day is in Table

Ask a question
 HolidayDate is date which is in Table
 newholiday is Table Name
 Actual_Leave_To is Column Name
 
I Have a Code Given Below-
 
 
 
declare @Actual_Leave_To date= '2016-08-13'
--set @Actual_Leave_To='2016-08-13'
while (select count(1) from newholiday where Holidaydate = @Actual_Leave_To)>0
begin
set @Actual_Leave_To = DATEADD(d,1,@Actual_Leave_To)
end
select @Actual_Leave_To
    
My Question is all  Public holiday date  in my table   newholiday so when is query running then increase 1 day in Actual_Leave_To and this cod is 
working my problem is  i declare 2016-08-13' this day and it add 1 day after running query but i want to know how it will understand when i declare
2016-08-12' next day is  2016-08-13 table and date add 2016-08-14
 
 
 
 

Answers (2)