



CREATE PROCEDURE DBO.IsSchemaDayInException @referencenumber int, @CurrentDate char(8),@result bit output AS
SET NOCOUNT ON
/*
 Dииииииииииииииииииииииииииииииииииииииииииииии!

*/
  Declare @Ex_Arrivaldate char(8)
  Declare @Ex_DepartureDate char(8)

    set @Result = 0

    Declare loopCur Cursor Forward_Only For

    select Arrivaldate,DepartureDate from reservationconferenceline  WITH (NOLOCK) where referencenumber=@ReferenceNumber and (Schemepattern = 7 or SchemePattern=8)

    Open LoopCur

    Fetch Next From LoopCur
    Into @Ex_Arrivaldate,@Ex_departuredate
    While  (@@FETCH_STATUS <> -1)
    Begin
    
      if @Currentdate >= @Ex_Arrivaldate and @Currentdate <= @Ex_departuredate
      begin
        set @result = 1
        break
      end

      Fetch Next From LoopCur
      Into @Ex_Arrivaldate,@Ex_departuredate
    end

    close loopcur
    Deallocate loopcur

