Link to home
Start Free TrialLog in
Avatar of al4629740
al4629740Flag for United States of America

asked on

query - get records from a particular month - converting date and/or time from character string

after entering the following  

select * from tblOrgProfile P
Inner Join tblOrgHours H on P.Agencyid = H.AgencyID
Inner Join tblOrgActivities A on A.ActivityID = H.ActivityID where H.Hours > 0 and H.Program = 'csw' and H.ActivityDate = 'May'

I get the error
Msg 241, Level 16, State 1, Line 1
Conversion failed when converting date and/or time from character string.

Actvitydate is format date.  How do I get all dates in the month of May
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of al4629740


what if I wanted May and June?
MONTH(H.ActivityDate) IN (5, 6)
thank you