Stop using between with datetimes unless you are ABSOLUTELY SURE that you know what you are doing and you ABSOLUTELY UNDERSTAND the datetime concept.
create table #test(
Id int not null identity(1,1) primary key clustered,
ActionDate datetime not null
)
insert into #test values
( '2015-12-31 23:59:59.99' ),
( '2016-01-01' ),
( '2016-01-10' ),
( '2016-01-31 23:59:59.99' ),
( '2016-02-01' )
select * from #test
-- all the rows
1 2015-12-31 23:59:59.990
2 2016-01-01 00:00:00.000
3 2016-01-10 00:00:00.000
4 2016-01-31 23:59:59.990
5 2016-02-01 00:00:00.000
-- lets locate all of January
-- using between
select * from #test
where
( ActionDate between '2016-01-01' and '2016-01-31' )
2 2016-01-01 00:00:00.000
3 2016-01-10 00:00:00.000
-- missing row 4
select * from #test
where
( ActionDate between '2016-01-01' and '2016-02-01' )
2 2016-01-01 00:00:00.000
3 2016-01-10 00:00:00.000
4 2016-01-31 23:59:59.990
5 2016-02-01 00:00:00.000 -- this is not January
-- using < and >
select * from #test
where
( '2016-01-01' <= ActionDate )
and ( ActionDate < '2016-02-01' )
2 2016-01-01 00:00:00.000
3 2016-01-10 00:00:00.000
4 2016-01-31 23:59:59.990
drop table #test