• dwain.c My personal preferences in cases like this is to combine the calendar (time slot) generation with the Tally table

    Yep, mine is to always keep things as separate and granular as possible so as to make troubleshooting easier, then combine only when necessary. It's funny how folks perceive the same thing in different ways. I'm thinking maybe your way results in a little less memory usage.

    I also through in a CROSS APPLY to create TimePeriod, which significantly shortens the code.

    I've not really used CROSS APPLY, or any APPLY for that matter, since I'm mainly hitting DB2, but you guys sure do some nifty stuff with it. Thanks Dwain, I always learn something from your posts.

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.