• awcrestview (4/8/2014)


    The start_datetime for this example would be graveyard shift which starts at 11pm on 4/6/14.

    Thank You

    Okay, so what you are looking for is the following based on a the date 2014-04-07 is this:

    where startdate >= '2014-04-06 23:00' and enddate < '2014-04-07 23:00'

    Is this a good paraphrase of what you need? If so, then something like this:

    WHERE startdate >= dateadd(hour, -1, dateadd(day, datediff(day, 0, getdate()), 0)) and enddate < dateadd(hour, -1, dateadd(day, datediff(day, 0, getdate()), 1))

    This assumes the getdate() returns '2014-04-07 hh:mm:nnn.nn'.