"news.wanadoo.nl" <fa*******@zonnet.nl> wrote in message
news:42***********************@news.wanadoo.nl...
Hi,
I've a problem with making a query. I need to get out a result where a
date for example 25-02-05 is in a table.
The problem is that the dates in the table are old like 25-02-03. So is
there a sollution where I only need the day and month to get the result?
Thanks,
Fred
select *
from dbo.MyTable
where right(convert(char(8), datecol, 112), 4) = '0225'
select *
from dbo.MyTable
where day(datecol) = 25 and month(datecol) = 2
These will return multiple rows, of course, if you have 20030225, 20020225
etc in your table - I don't know if that's what you want or not. Also check
out DATEPART() in Books Online.
Simon