Declare @BeginYear As SmallInt Declare @EndYear As SmallInt Declare @BeginMonth As TinyInt Declare @EndMonth As TinyInt Set @BeginYear = 2009 Set @EndYear = 2010 Set @BeginMonth = 10 Set @EndMonth = 2 Declare @BeginDate As Date Declare @EndDate As Date Set @BeginDate = DATEADD(MONTH, 12 * @BeginYear - 22801 + @BeginMonth , 1 - 1) Set @EndDate = DATEADD(MONTH, 12 * @EndYear - 22801 + @EndMonth, 31 - 1)