Quote:
|
AND osirReport.osirSignalDateTime < '" & (request.form("ToDate")+1) & "')..."
|
That's *exactly* what I do in my ASP code.
You can also do it in the T-SQL code, of course:
Code:
AND osirReport.osirSignalDateTime < DATEADD(d,1,'" & request.form("ToDate") & "')..."
In Access, you can use "... AND DATEVALUE(somedatetimefield) <= #8/31/2009#..."
And in MySQL, you can use " ... AND DATE(somedatetimefield) <= '2009-8-31' ..."
And, actually, in TSQL you *can* do
Code:
... AND CONVERT(DATETIME,CONVERT(VARCHAR,field,112),112) <= '8/31/2009' ...
But none of those are as efficient as what you used there.
Especially if the field in question is indexed.
Reason: When you use a function (or pair of functions) to convert a date+time to date-only, the DB engine has to hit every single record, doing the conversion.
With the code you used, if the field is indexed then the search can be done entirely in the index. In some cases this could offer orders of magnitude better performance. (Of course, if the field isn't indexed, the difference is minimal.)