Re: time(urgent)
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 05 Jan 2006 20:52:27 +0100
On Tue, 3 Jan 2006 21:28:02 -0800, shif wrote:
>HI
>Actualy i have a datetime field (entrydt) in my table,how can i fetch data
>where
>transaction between 8.30am and 4.30 pm from entrydt field.
Hi shif,
If the entrydt is populated with time only (i.e. the datepart is left at
the default 1/1/1900 value), you can use
WHERE entrydt >= '08:30:00'
AND entrydt < '16:30:00'
In this case, an index on the entrydt column can be used to locate the
matching rows.
But if entrydt contains different date parts, you'll have to use
something like the below, which (unfortunately) requires a table or
index scan to find the matching rows:
WHERE CONVERT(char(8), entrydt, 108) >= '08:30:00'
AND CONVERT(char(8), entrydt, 108) < '16:30:00'
Best, Hugo
--
Angband spoilers: http://ourworld.compuserve.com/homepages/hugo_kornelis/Angband/Spoiler/index.htm
Angband UI Patch: http://ourworld.compuserve.com/homepages/hugo_kornelis/Angband/UIpatch/index.htm
--
.
- References:
- Re: time(urgent)
- From: Hugo Kornelis
- Re: time(urgent)
- Prev by Date: Re: How to select all top 1s from different group in a view
- Next by Date: Re: How to select all top 1s from different group in a view
- Previous by thread: Re: time(urgent)
- Next by thread: Re: Max of different columns
- Index(es):