RE: Searching for Date
- From: "Mario Aoun" <MarioAoun@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Jul 2005 05:38:02 -0700
em,\
one way to solve such problem is the following:
SELECT * FROM APPOINTMENTS
WHERE (APPOINTMENTDATE >= Convert(Datetime, '2005-12-25 00:00:00', 102))
AND (APPOINTMENTDATE <= Convert(Datetime,
'2005-12-25 23:59:59', 102))
Mario Aoun
"em" wrote:
> Hi All,
>
> I'm having trouble searching by date value in a DATETIME field.
>
> If there is no time specified I can find the date fine, for example,
> SELECT * FROM APPOINTMENTS WHERE APPOINTMENTDATE='12-25-2005'
>
> But if APPOINTMENTDATE has a time specified, such as "12-25-2005 13:10:00",
> then the above query won't find it.
>
> So how can I find all rows that are on 12-25-2005 regardless of the time?
>
> Cheers
>
>
>
.
- Follow-Ups:
- Re: Searching for Date
- From: em
- Re: Searching for Date
- References:
- Searching for Date
- From: em
- Searching for Date
- Prev by Date: Re: Under what circumstances would GetDate() return NULL?
- Next by Date: Re: Searching for Date
- Previous by thread: Searching for Date
- Next by thread: Re: Searching for Date
- Index(es):
Relevant Pages
|