diff --git a/.gitattributes b/.gitattributes
index 32fb9e7fdb00688d601e71f83cb3057d23117762..559c5dfde264638e708daf270fc8697b35305197 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1356,7 +1356,9 @@ SAS/OTB/scripts/src/Makefile.am -text
 SAS/OTB/scripts/src/checkOTDBServer -text
 SAS/OTB/scripts/src/startOTB -text
 SAS/OTDB/sql/fresh_sas001_database.sh -text
+SAS/OTDB/sql/getSchedulerInfo.sql -text
 SAS/OTDB/sql/getTreeGroup_func.sql -text
+SAS/OTDB/sql/getTreesInPeriod_func.sql -text
 SDP/SPP/DSP[!!-~]BUILDER/myfilterbank.mdl -text
 SDP/SPP/MATLAB/gui2/gui_qt.fig -text svneol=unset#unset
 SDP/SPP/VHDL/FFT/aukfft_acmxaa.tdf -text svneol=unset#unset
diff --git a/SAS/OTDB/sql/getSchedulerInfo.sql b/SAS/OTDB/sql/getSchedulerInfo.sql
new file mode 100644
index 0000000000000000000000000000000000000000..7e27fee87265cd419da6dae086869de318b1ca50
--- /dev/null
+++ b/SAS/OTDB/sql/getSchedulerInfo.sql
@@ -0,0 +1,87 @@
+--
+--  getSchedulerInfo.sql: function for getting treeinfo from the OTDB
+--
+--  Copyright (C) 2010
+--  ASTRON (Netherlands Foundation for Research in Astronomy)
+--  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 2 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program; if not, write to the Free Software
+--  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+--
+--  $Id: getSchedulerInfo.sql 8438 2006-05-18 19:16:37Z overeem $
+--
+
+
+CREATE TYPE schedulerInfo AS (
+	CEPProcessingUnits     INT4,
+	declination            VARCHAR(20),
+	firstPossibleDate      VARCHAR(20),
+	fixedDay               BOOLEAN,
+	fixedTime              BOOLEAN,
+	lastPossibleDate       VARCHAR(20),
+	late                   BOOLEAN,
+	nightTimeWeightFactor  INT4,
+	nrOfSubbands           INT4,
+	offlineProcessingUnits INT4,
+	predMaxTimeDif         VARCHAR(20),
+	predMinTimeDif         VARCHAR(20),
+	predecessor            INT4,
+	priority               FLOAT,
+	referenceFrame         VARCHAR(20),
+	rightAscention         VARCHAR(20),
+	sources                TEXT,
+	storageUnits           INT4,
+	taskDuration           VARCHAR(20),
+	taskStatus             VARCHAR(20),
+	taskType               VARCHAR(20),
+	unscheduledReason      VARCHAR(20),
+	windowMaximumTime      VARCHAR(20),
+	windowMinimumTime      VARCHAR(20)
+);
+
+CREATE OR REPLACE FUNCTION getSchedulerInfo(INT4)
+  RETURNS schedulerInfo AS '
+    DECLARE	vRecord	schedulerInfo;
+	DECLARE fieldList CURSOR FOR
+      SELECT limits FROM getvhitemlist($1, \'%Observation.Scheduler.%\') ORDER BY name ASC;
+
+	BEGIN
+      OPEN fieldList;
+	  FETCH fieldList INTO vRecord.CEPProcessingUnits;
+	  FETCH fieldList INTO vRecord.declination;
+	  FETCH fieldList INTO vRecord.firstPossibleDate;
+	  FETCH fieldList INTO vRecord.fixedDay;
+	  FETCH fieldList INTO vRecord.fixedTime;
+	  FETCH fieldList INTO vRecord.lastPossibleDate;
+	  FETCH fieldList INTO vRecord.late;
+	  FETCH fieldList INTO vRecord.nightTimeWeightFactor;
+	  FETCH fieldList INTO vRecord.nrOfSubbands;
+	  FETCH fieldList INTO vRecord.offlineProcessingUnits;
+	  FETCH fieldList INTO vRecord.predMaxTimeDif;
+	  FETCH fieldList INTO vRecord.predMinTimeDif;
+	  FETCH fieldList INTO vRecord.predecessor;
+	  FETCH fieldList INTO vRecord.priority;
+	  FETCH fieldList INTO vRecord.referenceFrame;
+	  FETCH fieldList INTO vRecord.rightAscention;
+	  FETCH fieldList INTO vRecord.sources;
+	  FETCH fieldList INTO vRecord.storageUnits;
+	  FETCH fieldList INTO vRecord.taskDuration;
+	  FETCH fieldList INTO vRecord.taskStatus;
+	  FETCH fieldList INTO vRecord.taskType;
+	  FETCH fieldList INTO vRecord.unscheduledReason;
+	  FETCH fieldList INTO vRecord.windowMaximumTime;
+	  FETCH fieldList INTO vRecord.windowMinimumTime;
+      RETURN vRecord;
+    END;
+' language plpgsql;
diff --git a/SAS/OTDB/sql/getTreesInPeriod_func.sql b/SAS/OTDB/sql/getTreesInPeriod_func.sql
new file mode 100644
index 0000000000000000000000000000000000000000..2679f7d5f76681b670158cc0136e351fd76d251e
--- /dev/null
+++ b/SAS/OTDB/sql/getTreesInPeriod_func.sql
@@ -0,0 +1,73 @@
+--
+--  searchTreeInPeriod.sql: function for getting treeinfo from the OTDB
+--
+--  Copyright (C) 2005
+--  ASTRON (Netherlands Foundation for Research in Astronomy)
+--  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 2 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program; if not, write to the Free Software
+--  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+--
+--  $Id: getTreeList_func.sql 9997 2007-03-01 12:21:46Z overeem $
+--
+
+--
+-- getTreesInPeriod (treeType, startDate, endDate)
+-- 
+-- Get a list of trees.
+--
+-- Authorisation: none
+--
+-- Tables: 	otdbtree	read
+--			otdbuser	read
+--			campaign	read
+--
+-- Types:	treeInfo
+--
+CREATE OR REPLACE FUNCTION getTreesInPeriod(INT2, TIMESTAMP, TIMESTAMP)
+  RETURNS SETOF treeInfo AS '
+	DECLARE
+		vRecord		RECORD;
+		vQuery		TEXT;
+
+	BEGIN
+	  -- Construct where clause
+      vQuery := \'WHERE t.treetype = \' || chr(39) || $1 || chr(39) || \' AND (t.starttime <= \';
+	  vQuery := vQuery || chr(39) || $3 || chr(39) || \' AND t.stoptime >= \' || chr(39) || $2 || chr(39) || \')\';
+	  -- do selection
+	  FOR vRecord IN  EXECUTE \'
+		SELECT t.treeID, 
+			   t.momID,
+			   t.classif, 
+			   u.username, 
+			   t.d_creation, 
+			   t.treetype, 
+			   t.state, 
+			   t.originID, 
+			   c.name, 
+			   t.starttime, 
+			   t.stoptime,
+			   t.description
+		FROM   OTDBtree t 
+			   INNER JOIN OTDBuser u ON t.creator = u.userid
+			   INNER JOIN campaign c ON c.ID = t.campaign
+		\' || vQuery || \'
+		ORDER BY t.treeID ASC\'
+	  LOOP
+		RETURN NEXT vRecord;
+	  END LOOP;
+	  RETURN;
+	END
+' LANGUAGE plpgsql;
+