Groups | Blog | Home
all groups > sql server programming > april 2005 >

sql server programming : SQL command problem


Ole Kristian Bangås
4/10/2005 11:42:02 AM
"Alan Ho" <gto_station@yahoo.com.hk> wrote in news:uTghpvfPFHA.1392
@TK2MSFTNGP10.phx.gbl:

[quoted text, click to view]

I would use the between keyword, and a field of type datetime. Note that
you most likely will need to use the date part of the value in addition to
the time.

--
Ole Kristian Bangås
Alan Ho
4/10/2005 7:34:36 PM
how can i get data from database...between 1time and 1 time..
e.g. select * from abc where time > 12:00 and time <20:00 <----but it
seems not work

thanks

mark baekdal
4/10/2005 11:37:01 PM
like this...

select
*
from
dbo.abc
where
datepart(hour,[time]) > 12
and datepart(hour,[time]) < 20

remember between is inclusive.


regards,
Mark Baekdal
http://www.dbghost.com
http://www.innovartis.co.uk
+44 (0)208 241 1762
Database change management for SQL Server




[quoted text, click to view]
AddThis Social Bookmark Button