I have a datetime field called DateFinished. I need to be able to retrieve all records in which DateFinished is within the current month/year.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’ve only got a small number of rows, this will do to get all rows where
DateFinishedis in this month of this year.This could get quite slow over a large number of rows though – in which case using
DateAdd,DatePartandBETWEENis probably more appropriate, and can take advantage of indexes (I don’t have time to write an answer involving those right now!)