I would like to know the fastest way to compare two datetimes omiting the year. (In one of my querys it takes 55 secs becouse of this comparision)
As of now it have tried (with no difference in times):
where datepart(d,date1)=datepart(d,date2) and datepart(m,date1)=datepart(m,date2)
where CAST(datepart(d,date1) as varchar)+ CAST(datepart(m,date1) as varchar) =CAST(datepart(d,date2) as varchar)+ CAST(datepart(m,date2) as varchar)
where datepart(y,date1) =datepart(y,date2)
where CAST(DAY(date1) as varchar)+ CAST(MONTH(date1) as varchar) =CAST(DAY(date2) as varchar)+ CAST(MONTH(date2) as varchar)