I have a database in SQL Server 2005.I've a table namely 'PersonalDetails' in it which contains a 'date of birth' field of type datetime.I've to generate weekly birthday reports .
I wrote a sp like this:
ALTER PROCEDURE [dbo].[selectweekfrompersonaldetails]
(
@paramdate datetime ='02/01/2007'
)
as
-- select EmpID,EmpName,month(DateOfBirth) bmon,day(DateOFBirth) bday from PersonalDetails where (day(dateofbirth) between day(@paramdate1) and day(@paramdate1+7)) and month(dateofbirth)=month(@paramdate1)
select EmpID,EmpName,month(dateofbirth) bmon,day(dateofbirth) bday from PersonalDetails where (day(dateofbirth) >= day(@paramdate) and day(dateofbirth)<=day(dateadd(dd,7,@paramdate)))---and(month(dateofbirth)=month(@paramdate) or month(dateofbirth)=month(dateadd(dd,7,@paramdate)))
but it does not work.
Can u guide me in this