I have a table 'policy' with [DateCreated] [datetime] NOT NULL column and I tried to run a simple select statement
select datecreated from Policy where (policy.DateCreated BETWEEN '2015-04-17 00:00:00.000' AND '2015-04-17 23:59:59.997')
I am getting the below error
Msg 242, Level 16, State 3, Line 1
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
However Table has valid data [dateformat in datetime column : 2015-04-17 09:08:50.250]
Can anyone please tell me why i am getting this error message?