declare @startDate datetime set @startDate = Convert(DateTime,(CONVERT(varchar(10), getdate(), 120 )+ ' 01:00'))declare @endDate datetime set @endDate = Convert(DateTime,(CONVERT(varchar(10), getdate(), 120 )+ ' 04:00'))select IP from tt where [DateTime] between @startDate and @endDate
set @startDate = Convert(DateTime,(CONVERT(varchar(10), getdate(), 120 )+ ' 01:00'))declare @endDate datetime
set @endDate = Convert(DateTime,(CONVERT(varchar(10), getdate(), 120 )+ ' 04:00'))select IP from tt
where [DateTime] between @startDate and @endDate