SELECT workingDate,*
from (
(SELECT *,DATEADD(DAY,ROWNO,TrainingStartDate)workingDate
FROM (SELECT *,ROW_NUMBER() OVER(ORDER BY Trainingid)ROWNO FROM TABLE) A
)
) B
where workingDate between TrainingStartDate and TrainingEndDate
and workingdate not in(select holidaydate from holiday_Master)
AND DATENAME(DW,workingDate) NOT IN ('SATURDAY','SUNDAY')
|