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

asked on

error on query datetime by month

select frmRegistrationCSWText1, count(Distinct ID) from frmRegistrationCSW where entrytime = 'january' group by frmRegistrationCSWText1

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

How do I specifiy entrytime correctly.  datatype is datetime for that entrytime
ASKER CERTIFIED SOLUTION
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could always just use the month number:

where month(entrytime) = 1

Open in new window


Neither option of course, takes the year into account.