>I have a long date field that stores Date like "6/14/2006 11:30:00 AM"
> I would like to query this field as short date... like
> ssql = "Select DateX from TableY where DateX between 6/14/2006 and
> 6/15/2006"
> So the SQL should ignore the time part.
You have to tack on "11:59:59 PM" to the "high" date. After all these
iterations of SQL Server, you'd think there'd be a function for this or
something, but there isn't.
JP Bless - 16 Jun 2006 17:47 GMT
Thanks Jeff.
> >I have a long date field that stores Date like "6/14/2006 11:30:00 AM"
> > I would like to query this field as short date... like
[quoted text clipped - 5 lines]
> iterations of SQL Server, you'd think there'd be a function for this or
> something, but there isn't.
Chris Anderson - 28 Jul 2006 22:12 GMT
Why tack it on?
the 15th is clearly after the 14th, so even though DateX has 11:30am, it
will still get picked up since it is between the two dates.
As for a function: DateAdd(s, -1, DateAdd(d, 1, @SomeDate))
Will add one day, the take off one second....
Chris Anderson [VB-MVP]
>> I have a long date field that stores Date like "6/14/2006 11:30:00
>> AM"
[quoted text clipped - 5 lines]
> iterations of SQL Server, you'd think there'd be a function for this
> or something, but there isn't.