title: SQL Server date/time overlapping check for event scheduling
body: <p>I have a event table that has the following columns:</p>
  
  <pre><code>StartDate datetime
  EndDate datetime
  StartTime nvarchar(10)
  EndTime nvarchar(10)
  </code></pre>
  
  <p>Let's say a record has these values in the table:</p>
  
  <pre><code>StartDate: 2011-12-22 00:00:00.000
  EndDate: 2011-12-22 00:00:00.000
  StartTime: 4:00 PM
  EndTime: 5:00 PM
  </code></pre>
  
  <p>Now, if someone comes to schedule an event, I need to make sure he can't schedule it for the same time or between the start and end times of this existing event.</p>
  
  <p>So, he can schedule from 5:00 PM to 6:00 PM or from 11:00 AM to 4:00 PM but not 11:00 AM to 5:00 PM or 4:30 PM to 5:00 PM.</p>
  
  <p>How can I check for this?  I know this isn't the best design for this table, but I have to stick to this design, else we will have to change a lot of middle layer and client side code.</p>