Essayez ce script, il trouve les dates manquantes sans spécifier de constantes -.
DECLARE @CollegeDate TABLE
(
College NVARCHAR(10)
, Dept NVARCHAR(10)
, JoiningDate DATETIME
)
INSERT INTO @CollegeDate (College, Dept, JoiningDate)
VALUES
('SAEC', 'CSE', '2/1/2008'),
('MSEC', 'EEE', '2/4/2008'),
('GOV', 'ECE', '2/8/2008'),
('JKP', 'CSE', '2/9/2008'),
('VLM', 'CSE', '2/10/2008'),
('PTR', 'CSE', '2/13/2008')
;WITH dateout AS
(
SELECT
JoiningDate = MIN(JoiningDate)
, MaxJoiningDate = MAX(JoiningDate)
FROM @CollegeDate
UNION ALL
SELECT
JoiningDate + 1
, MaxJoiningDate
FROM dateout
WHERE JoiningDate < MaxJoiningDate
)
SELECT d.JoiningDate
FROM dateout d
WHERE d.JoiningDate NOT IN (SELECT c.JoiningDate FROM @CollegeDate c)
ORDER BY d.JoiningDate