[quoted text, click to view] 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