this shows the principle. modiy it to your needs.declare @t table (dt datetime)insert into @tselect GetDate() union allselect dateadd(hh, -1, GetDate()) union allselect dateadd(hh, -2, GetDate()) union allselect dateadd(hh, -3, GetDate()) union allselect dateadd(hh, -4, GetDate()) union allselect dateadd(hh, -5, GetDate())select * from @tdeclare @after intset @after = 18SELECT *from @twhere dt > dateadd(hh, @after, DATEADD(d, DATEDIFF(d, 0, dt), 0))
Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp