I am building a database for an institution. However, I will love the database to intimate the operator of birthdays of those in the database using vb 2008 and sql server. My query for the sql server goes thus:

select Surname, Other_Names, Mobile_Phone from Parishioner_Adults where WHERE day(Date_of_Birth) =day((GETDATE()+15)) AND month(Date_of_Birth)=month(getdate())

But I am not getting any result when it is called. Please can anyone give me a suggestion please.

5 Years
Discussion Span
Last Post by poojavb

if may work for the first 14 days of the month but if it is currently 20th of June then adding 15 will give you 35th of June which not many people have as a birthday. Try adding 15 to the getdate with the dateadd function before using day function DateADD reference.

You will need to use it for both getdate calls.

Edited by ChrisPadgham

Votes + Comments
I agree

The birthday calculation part u need it for some particular day or 15 days onwards.....

Find the below query that will show the birthdays from current day to coming 15 days

select ID, FName, MobNo, Email, BirthDate 
FROM Tablename 
Day(BirthDate) between day(GETDATE()) and day(GETDATE()+15) and 
month(BirthDate) between month(GETDATE()) and month(GETDATE()+15)

Hope it helps u....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.