In sql 2005, instead of building a query from dateparts year, month and date,
is there an more succinct way of writing the where clause?
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.
In SQL 2000 and SQL 2005 you can use a nice select statement to remove the time component from a DateTime, ie
will return 6-Apr-2010 (well for today only).
So combined with marc_s’s answer, you’d want
Edit: Changed to suit requirements, note the 1 in the second DateAdd (this adds the days it has been from the beginning to 1 (instead of 0), making it 7th Apr 2010 00:00:00)
If you want 6th Apr 23:59:59 you take a second away from the second date
Final Call would become
Ok that’s alot of info at once! Hope it all makes sense 🙂