whats the datatype of STartTime and EndTime in CenterDowSettingDetail table?
Also current is looking only for slots that comes outside the range chosen.
i think the check should have been
IF NOT EXISTS(SELECT 1 FROM CenterDowSetting CDS
INNER JOIN CenterDowSettingDetail CDSD
ON CDS.CenterDowSettingID = CDSD.CenterDowSettingID
WHERE CDS.DowID = @DowID
AND ((StartTime < @starttime AND EndTime > @starttime)
OR (StartTime < @endtime AND EndTime > @endtime ))
)
SELECT 'No Conflicts'
ELSE
SELECT 'Conflicts'
------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/