November 7, 2013 at 11:52 am
If StartDateTime is a datetime field, are these where clauses equal.......
where StartDateTime>='2013-10-01' and StartDateTime<'2013-10-31'
where StartDateTime>='2013-10-01' and StartDateTime<dateadd(d, 1, '2013-10-31')
where StartDateTime between '2013-10-01' and '2013-10-31'
What is the correct way to handle this?
November 7, 2013 at 11:58 am
They're not equal if StartDateTime is datetime. The correct way to go is up to you to decide.
where StartDateTime>='2013-10-01' and StartDateTime<'2013-10-31'
will go from '2013-10-01 00:00:00.000' to '2013-10-30 23:59:59.997'
where StartDateTime>='2013-10-01' and StartDateTime<dateadd(d, 1, '2013-10-31')
will go from '2013-10-01 00:00:00.000' to '2013-10-31 23:59:59.997'
where StartDateTime between '2013-10-01' and '2013-10-31'
will go from '2013-10-01 00:00:00.000' to '2013-10-31 00:00:00.000'
November 7, 2013 at 12:06 pm
Thanx.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply