CREATE FUNCTION dbo.IsRecurringDayInException (@AParentID INT, @ADate DATETIME)
--Created AV 2009 0217 Used from sp GetScheduleExpressData. 

RETURNS BIT AS  
BEGIN 

  DECLARE @Result BIT
  SET @Result = 0

  IF EXISTS (SELECT * FROM Schedule WITH (NOLOCK) WHERE ParentID = @AParentID AND EventType = 3 
  AND  CONVERT(VARCHAR(8), Finish, 112) = CONVERT(VARCHAR(8), @ADate, 112) AND CONVERT(VARCHAR(8), Start, 112) = CONVERT(VARCHAR(8), @ADate, 112)) 
    SET @Result = 1

  RETURN @Result

END





