What data type did you define the column you are refering to ?
/* Example using DateTime data type */
Select DATEADD(HH, datediff(HH, 0, getdate()) - 1, 0) FromHH
, DATEADD(HH, datediff(HH, 0, getdate()), 0) ToHH
, DateTimeLastRun
from yourschema.YourTableOrView
where DateTimeLastRun>= DATEADD(HH, datediff(HH, 0, getdate()) - 1, 0)
and DateTimeLastRun< DATEADD(HH, datediff(HH, 0, getdate()), 0)
order by DateTimeLastRun ;
/* Example using Time data type */
Create table #ssc ( idnr int identity(1,1) not null primary key, Dt date not null default getdate() , Tm time not null default getdate() ) ;
go
insert into #ssc default values
go 50
select *
from #ssc
where Tm >= '09:36:18'
and Tm < '09:36:25'
order by Dt
, Tm ;
select *
from #ssc
where Tm >= '9:36 AM'
and Tm < '9:37 AM'
order by Dt
, Tm ;
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me