This is original message quoted:
What is the right syntax for BETWEEN with two DateTime values (in SQL Select called from VFP app)? I am using the following syntax and getting an error:
TableName.FieldName between {^2010-04-01 00:00:00} and {^2010-05-01 00:00:00}
And this is quoted from the blog lines you provided:
SELECT COUNT(*)
FROM dbo.SomeLogTable
WHERE DateColumn BETWEEN '20091011' AND '20091012';
Well, this approach is okay, as long as you don't have any rows that fall on midnight at the upper bound - which can be much more common if parts of your application strip time from date/time values. In that case, this query will include data from the next day; not exactly what was intended. In some cases, that *is* what is intended: some people think the above query should return all the rows from October 11th, and also all the rows from October 12th. Remember that this query can be translated to one of the following, without changing the meaning:
SELECT COUNT(*)
FROM dbo.SomeLogTable
WHERE DateColumn BETWEEN '2009-10-11T00:00:00.000' AND '2009-10-12T00:00:00.000';
SELECT COUNT(*)
FROM dbo.SomeLogTable
WHERE DateColumn >= '2009-10-11T00:00:00.000' AND DateColumn <= '2009-10-12T00:00:00.000';
(Note that in the second example, that is greater than or equal to the first variable and less than or equal to the second variable.) This means that you will return rows from October 12th at exactly midnight, but not at 1:00 AM, or 4:00 PM, or 11:59 PM.
***********************************************
So I would say Thanks, period.
Cetin