• Thanks for the article. Jolly good show man. (c;

    We have many intersecting datetime queries and we are usually looking for ANY event that intersects a given time period. That is, even if the process started the day before and finishes the day after, we want to know about it. (If you don't, then ignore this advice). If you do care about those, then the cases 2,3,4,5 can be simplified like this:

    timeslice begins before the process ends and

    timeslice ends after the process starts

    which can be expressed like this:

    [StartingTime] = 7/1/2007 12:00 PM -- true for all except case 1

    Also, thanks to Ryan on the 2005 Common Table Expression. All of our clients are not yet running 2005 so I haven't gotten to play too much with the CTEs.