Joe,
>between @logdate and @logdate2", where @logdate2 is @logdate + 1One gotcha with this is that the BETWEEN clause is all inclusive, so that, in your example, this would include midnite of the following day, which is typically not what you want. That's why I said in my reply to use >= and < rather than BETWEEN.
~~Bonnie
>Short and sweet. SQL datetime fields always return a full date time. Which is a double sided sword.
>
>While searching for all records on a particular day a where clause is used like "where logdate = @logdate", when they are passing @logdate as '01/01/2004'. '01/01/2004' really means '01/01/2004 00:00:00.000' and will not return data for the complete day.
>
>The problem can be solved by using the between clause. The where clause for such a query should be "where logdate between @logdate and @logdate2", where @logdate2 is @logdate + 1. The between clause can make use of an index if it exists, where using a convert function like "where convert(varchar,logdate,101) = @logdate" would not and it would slow down the query.
>
>HTH,