Home Forums SQL Server 2008 SQL Server Newbies Duplicating Data To Each Saturday That a Promotion Is Live For RE: Duplicating Data To Each Saturday That a Promotion Is Live For

  • Firstly you did not post DDL and DML for your temp table, that said, based on what you have already done you could simply extend the end date by the number of week days, as in:

    SELECT a.CT_Prom_Start, a.CT_Prom_End, b.CalendarDate Promo_Week_End

    FROM #temp_willowton16Jan18 a left join #cal b

    ON b.CalendarDate>=a.[ct_prom_start]

    AND b.CalendarDate<=dateadd(day, 5, a.[ct_prom_end])

    WHERE IsWeekend = 1 AND weekdayno=7

    This may not be an ideal solution but should give you want you want.

    ...