• Lynn Pettis (6/7/2013)


    tmac25 (6/7/2013)


    So, say I have a record where StartTime is '2013-06-07 13:00:00.000' and EndTime is '2013-06-07 13:02:00.000'

    Is there a way to have T-SQL select this record if I'm querying for time between StartTime and EndTime that is '2013-06-07 13:01:00.000'? Essentially I'm looking for all records where StartTime and EndTime overlap with the time I'm querying for.

    I can't figure out the syntax for it, and I'm not having any luck searching for it.

    Thanks for any help you can provide!

    ...

    WHERE

    @SearchDateTime between StartTime and EndTime -- where StartTime and Endtime are the actual column names in the table

    ...

    I can't believe it was that simple, thank you!