We help IT Professionals succeed at work.

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

al4629740
al4629740 asked
on
1,008 Views
Last Modified: 2014-05-19
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
Comment
Watch Question

SQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
what if I wanted May and June?
Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015

Commented:
MONTH(H.ActivityDate) IN (5, 6)

Author

Commented:
thank you
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.