June 29, 2004 at 8:07 am
this should help
select xys from mytable where datepart(dd,mytable.datefield)=datepart(dd,getdate()) and datepart(mm,mytable.datefield)=datepart(mm,getdate())
Cheers
MVDBA
June 29, 2004 at 9:24 am
Thanks, that did it!
JW
June 29, 2004 at 9:46 am
Just for the sake of another option
where right(convert(char(8),mytable.datefield,112),4) = right(convert(char(8),getdate(),112),4)
June 30, 2004 at 3:32 am
out of interest is it quicker?
MVDBA
June 30, 2004 at 5:18 am
Don't know for sure. I usually just test a few options to see which gives best performance for the data in question, just make sure you run several times for comparison and clean the buffers between runs for best compare if possible.
Viewing 5 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply