Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date:time

Status
Not open for further replies.

CSOP

Technical User
Sep 26, 2003
9
GB
Hi There,

I've got a field expiry_date which is type date:time. This field contains all variety of dates. I would like to find all data which has an expiry date in March i.e

like '1998-03-31 00:00:00'

or like '____-03-__ 00:00:00'

when I carry this query out I get no result returned. Even though I know they exist. When I try this with = I do get results but I'm not looking for an exact match just dates in March.

Hope this makes sense

Please help
 
where right(convert(varchar(6),dte,112),2) = '03'

or

where datepart(mm,dte) = 3


======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Fantastic just what I need thanks Nigel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top