i have a table like as student.
m having data from 31/06/2009 till 06/08/2015
where i always put the records of all the students on daily basis so now i want to find out the dates in which i haven't added the data in student table.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Upendra Pratap ShahiPosted Aug 7, 2015, 8:26 AM
DECLARE @s DATE = '20150418', @e DATE = '20150708';
SELECT c.d, ID = COALESCE(s.ID,0)
FROM
(
SELECT TOP (DATEDIFF(DAY, @s, @e)+1)
DATEADD(DAY, ROW_NUMBER() OVER (ORDER BY number)-1, @s)
FROM [master].dbo.spt_values
WHERE [type] = N'P' ORDER BY number
) AS c(d)
LEFT OUTER JOIN [dbo].[PhotograperRegistration] AS s
ON c.d = s.Profile_CreatedDT
WHERE c.d >= @s
AND c.d < DATEADD(DAY, 1, @e);
ravi rawatPosted Aug 7, 2015, 5:35 AM
Upendra Pratap ShahiPosted Aug 7, 2015, 4:01 AM
Rohan GuptaPosted Aug 7, 2015, 3:54 AM