Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

request records from a specific month

Posted on 2011-10-14
4
Medium Priority
?
277 Views
Last Modified: 2012-06-27
EntryTime is a column with datetime as its format type.  

I want to request the number of records from the database where all the records are from July.

I know this code is wrong below
esql = "select count(*) from tblRegistration where EntryTime = 'July'

Open in new window

0
Comment
Question by:al4629740
  • 2
4 Comments
 
LVL 4

Expert Comment

by:JillofallTradesMistressofNone
ID: 36972330
Something like this?

SELECT * FROM DateSample
WHERE MONTH(DateVal) = 7

Check out:

http://vyaskn.tripod.com/searching_date_time_values.htm
0
 

Author Comment

by:al4629740
ID: 36972369
Can I do this instead

SELECT * FROM tblRegistration WHERE MONTH(EntryTime) = 'July'

I don't want to use numericals for the month
0
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 2000 total points
ID: 36972565
Yes.

SELECT * FROM tblRegistration WHERE datename(month, EntryTime) = 'July'

Raj
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 36973442
Glad I could help you
Raj
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

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

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Suggested Courses

580 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