• alen teplitsky (8/18/2010)


    nice article

    i tried using it today and the only problem was that my source data had hours and minutes and it would have taken too long to figure out a way to join it properly

    I know this is an old post but figured I'd show how easy that join actually is thanks to Todd's forsight in including a "NextDay" column ...

    SELECT whatever

    FROM dbo.yourtable yt

    INNER JOIN dbo.Calendar c

    ON yt.YourDate >= c.DayDate

    AND yt.YourDate < c.NextDay

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)