See
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_21419664.html?qid=21419664 and
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=70975I would solve this problem by converting dates to one common year. We would need to figure out leap year too.
I actually had the problem solved back in a day, but I forgot now...
>>Hilmar,
>>
>>>From a list of people with birth dates, how do I find out who has a birthday within a certain range of dates - e.g., the current week?
>>
>>
>>select * from theTable where date( year( ldStart ), month( dob ), day( dob ) ) between ldStart and ldEnd
>>
>
>Looks interesting - I have to analize it later. Do you think that would fail for a date range spanning end-of-year? E.g. {^2009-12-30} to {^2010-01-05}. If it does fail (and works otherwise, as I think it would), I could code that case separately - dividing into two ranges.
If it's not broken, fix it until it is.
My Blog