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.

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.

commented: I agree +0

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....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.