• CELKO (9/23/2010)


    I still prefer Julianizing the business days to make the math easier

    CREATE TABLE Calendar

    (cal_date DATE NOT NUL PRIMARY KEY,

    julian_business_nbr INTEGER NOT NULL,

    ...);

    INSERT INTO Calendar

    VALUES ('2007-04-05', 42),

    ('2007-04-06', 43), -- good friday

    ('2007-04-07', 43),

    ('2007-04-08', 43), -- Easter sunday

    ('2007-04-09', 44),

    ('2007-04-10', 45); --Tuesday

    To compute the business days from Thursday of this week to next

    Tuesday:

    SELECT (C2. julian_business_nbr - C1. julian_business_nbr)

    FROM Calendar AS C1, Calendar AS C2

    WHERE C1.cal_date = '2007-04-05',

    AND C2cal_date = '2007-04-10';

    Yes, we do it too. When a new holiday comes up, like President Ford's funeral, we update all those future numbers.