>CREATE PROCEDURE [dbo].[ctx_Personnel_WithRoomConflict_GetByTypeIdDepartmentIdAndDateRange] >@PersonnelTypeId INT, >@DepartmentId INT, >@ExcludedCaseId INT, >@CaseStartDateTime DATETIME, >@CaseEndDateTime DATETIME >AS > >SET NOCOUNT ON > >DECLARE @Start DATETIME >DECLARE @End DATETIME > >SET @Start = CONVERT(DATETIME, CONVERT(varchar, @CaseStartDateTime, 100)) >SET @End = CONVERT(DATETIME, CONVERT(varchar, @CaseEndDateTime, 100)) > >>
>WHERE > m.meetingnumber <> @ExcludedCaseId > AND > ( > (@CaseStartDateTime > m.begintime AND @CaseStartDateTime < m.endtime) > OR (@CaseEndDateTime > m.begintime AND @CaseEndDateTime < m.endtime) > OR (m.begintime > @CaseStartDateTime AND m.begintime < @CaseEndDateTime) > OR (m.endtime > @CaseStartDateTime AND m.endtime < @CaseEndDateTime) > OR(@CaseStartDateTime = m.begintime AND @End = m.endtime) > ) >I'm guessing they thought they were going to use it more than once, and only wanted to convert the values once.