Blog:-
Joels Blog - Ramblings of a madman:
Working out who's Birthday it is
Entered: 29/01/2010 @ 10:03 By: Joel
I spent some time yesterday (much longer than I had original expected it would) to write a quick report to tell us who's birthday was coming up (based on their date of Birth).
Im no genius with MS SQL, but here is what I came up with - which actually worked:
datediff(day, getdate(), dateadd(year, (year(getdate()) - year(DOB)), DOB))
This give the number of days (in the year) to the given persons birthday, and then I ran a quick filter depending on how far in advance we were interested in.
Tagged as: SQL Birthday
This post has 0 comments - Add a Comment.
____________________________________________________