SQL server time related -


i want take fields 9 pm 11 table month in sql server 2008.

i tried

 select * your_table  datecol between  (datecol=cast (getdate() date) , timecol<'21:00:00') ,  (datecol=cast (getdate() date) , timecol<'11:00:00') , datecol between '2014-01-01 00:00:00.000' , '2014-01-31 23:59:59.760' 

for month, fields time of 9pm t0 11 am

try !

 ;with cte     (     select *,cast(datetime_col time) x1,cast(datetime_col date) x2 table001     )      select * cte x1 between 21:00:00 , 11:00:00  , x2 between 01-jan-2014 , 31-jan-2014 

read date formats


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -