Jochem

Thanks for this, it does seem tricky.   

As a fix I have created a DATE_SERIAL field in the appropriate tables
which is an integer based on datediff(d,'1 Jan 2000',mydate) maintained
by a trigger on the actual datetime field (which will rarely alter).
Indexes easily enough and seems the simplest way to go in queries.  

Jochem van Dieten wrote:
>
> Richard Meredith-Hardy wrote:
> >
> > I had thought of this, it just is awfully verbose
> >
> > I've quite a lot of these date comparison queries to convert, I wonder
> > if there's another way which avoids the complication of the H:M:S at
> > all?
>
> The usual solution is to use CAST(updated TO DATE) to cast the
> datetime field to a date field on the fly. Then you can use a
> simple equality operator (and the result of the cast is indexable
> for most databases). But date/time handling is not exactly where
> MS SQL Server excels: there is no date datatype to cast to.
>
> Jochem
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to