Avatar of al4629740
al4629740
Flag 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
Microsoft SQL Server

Avatar of undefined
Last Comment
al4629740

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jim Horn

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
al4629740

ASKER
what if I wanted May and June?
Jim Horn

MONTH(H.ActivityDate) IN (5, 6)
al4629740

ASKER
thank you
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck