----  Using Table variable  ----
Declare @dateRange table(num INT NOT NULL PRIMARY KEY)
Declare @startDate datetime
Declare @endDate datetime
Declare @dateFromDB table(d datetime)

set @startDate = '2011-05-21'
set @endDate = '2011/6/4';

WITH numbers AS 
( 
 SELECT 1 AS num 
 UNION ALL 
 SELECT num + 1 FROM numbers  
     WHERE num < (SELECT DATEDIFF(dd, @startDate, @endDate + 1)) 
) 
INSERT INTO @dateRange 
    SELECT num FROM numbers

INSERT INTO @dateFromDB
	SELECT [InventoryDateTime]
	FROM [RpoPrTracker].[dbo].[DailyTankInventory]
	WHERE [RpoPrTracker].[dbo].[DailyTankInventory].[EquipmentCode] = 'T2701'
        AND [InventoryDateTime] >= @startDate AND [InventoryDateTime] <= @endDate

SELECT d
	FROM @dateRange AS a
	LEFT OUTER JOIN @dateFromDB AS b 
	ON DATEADD(dd, a.num , @startDate -1) = b.d

SELECT DATEADD(dd, num - 1, @startDate) missingDate 
   FROM @dateRange t1 LEFT OUTER JOIN @dateFromDB t2  
   ON CAST(DATEADD(dd, t1.num, @startDate -1) AS DATE)  = CAST(t2.d AS DATE) 
   WHERE t2.d IS NULL; 



----   Using Temp Table  ----
CREATE TABLE #dateRange (num INT NOT NULL PRIMARY KEY);
CREATE TABLE #dateFromDB (d datetime);
Declare @startDate datetime
Declare @endDate datetime
set @startDate = '6/1/2011'
set @endDate = '2011/6/4';

WITH numbers AS 
( 
 SELECT 1 AS num 
 UNION ALL 
 SELECT num + 1 FROM numbers  
     WHERE num < (SELECT DATEDIFF(dd, @startDate, @endDate + 1))
) 
INSERT INTO #dateRange 
    SELECT num FROM numbers;
	
INSERT INTO #dateFromDB
	SELECT [InventoryDateTime]
	FROM [RpoPrTracker].[dbo].[DailyTankInventory]
	WHERE [RpoPrTracker].[dbo].[DailyTankInventory].[EquipmentCode] = 'T5411';

SELECT DATEADD(dd, num - 1, @startDate) missingDate 
   FROM #dateRange t1 LEFT OUTER JOIN #dateFromDB t2  
   ON CAST(DATEADD(dd, t1.num, @startDate -1) AS DATE)  = CAST(t2.d AS DATE)
   WHERE t2.d IS NULL; 
   
DROP TABLE #dateRange;
DROP TABLE #dateFromDB;