Click here to Skip to main content
15,911,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai ,

I have a table Student_transport_Details having columns :

UserId
DesignatonId
StartDate
Enddate

I need to get records for a particular month.
Can i retrieve records by passing MonthId [between 1 -12].



Thanks in advance
Posted

Check this:
SQL
select * from Student_transport_Details where DATEPART(mm, StartDate) = 7 ;
 
Share this answer
 
v3
SQL
SELECT * FROM myTable WHERE DATEPART(month, StartDate)=10
 
Share this answer
 
Comments
Corporal Agarn 28-Oct-11 10:38am    
OriginalGriff's answer will work for the problem as stated. However if you want the details active in a month. That is a different problem.
Amir Mahfoozi 2-Nov-11 7:35am    
+5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900