Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more: , +
how to get upcoming bday alert from sql server that i want show as message in my project
Posted

1 solution

Hi,
try following Query for upcoming Bdays
SQL
SELECT  bDate  AS
Birthday  ,FLOOR(DATEDIFF(dd,bDate,GETDATE()) / 365.25) AS
 Age_Now  ,FLOOR(DATEDIFF(dd,bDate,GETDATE()+180) / 365.25) AS
 Age_After_this_Week
 FROM   CustomerMaster WHERE 1 = (FLOOR(DATEDIFF(dd,bDate,GETDATE()+180) / 365.25))
    -           (FLOOR(DATEDIFF(dd,bDate,GETDATE()) / 365.25))

Note- 180 for get bdays from upcoming 6 months
thanks
best Luck
Happy Coding:)
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900