CREATE FUNCTION dbo.NumberOfRoomsForRoomType (@ARoomTypeNumber INT) RETURNS INTEGER AS
BEGIN
  DECLARE @Res INT
  SELECT @Res = COUNT(*) FROM Rooms WITH (NOLOCK) WHERE RoomTypeNumber = @ARoomTypeNumber

  RETURN @Res
END