CREATE FUNCTION dbo.IsGroupNOX(@ReferenceNumber INT)
RETURNS BIT AS  
/*
   Created by Jacob Pedersen October 2005
*/
BEGIN 
  DECLARE
  @IsNOX BIT,
  @ResCount INT
  
  SELECT @ResCount=COUNT(ReferenceNumber) FROM Reservations WITH (NOLOCK) WHERE ReferenceNumber=@ReferenceNumber AND Status<6

  IF @ResCount = 0
    SET @IsNOX = 1
  ELSE
    SET @IsNOX = 0

  RETURN @IsNOX
END

