Skip to content
Advertisement

Compare 2 time datatype

I have a table in SQL Server which has 2 columns StartTime AND EndTime. The datatype of both columns in time(7). So when I view data in the table it can look like this:

08:33:00.0000000

or

19:33:00.0000000

I want to return all the rows in the table where StartTime and EndTime conflicts with another row.

Example table TimeTable

Type of query I am trying to do:

Expected result:

Advertisement

Answer

You can use logic like this for at least a fraction of a second of overlap:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement