0
votes

I'm trying to get values whose CreateDate is before 13.12.2016 - 18:30 I have this query :

SELECT *
  FROM [myDB].[dbo].[MyTable] WHERE RecordNo is not null AND CreateDate < '13/12/2016 6:30:00 PM'

When I run this query, I get this error :

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

How can I fix this? Thanks.

1

1 Answers

2
votes
SELECT *  FROM [myDB].[dbo].[MyTable] WHERE RecordNo is not null AND  
CreateDate < CONVERT(DATETIME,'13/12/2016 6:30:00 PM',103)