Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

error on query datetime by month

Posted on 2014-03-27
2
Medium Priority
?
135 Views
Last Modified: 2014-03-27
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
0
Comment
Question by:al4629740
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 25

Accepted Solution

by:
Lee Savidge earned 2000 total points
ID: 39959543
where datename(m, entrytime) = 'january'

Open in new window

0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 39959550
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.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question