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.
Asked
Active
Viewed 446 times
-2
-
2Show the code that is generating the error. – Gordon Linoff Jun 13 '17 at 11:52
2 Answers
2
By default it normally will be yyyy-mm-dd so you might require to provide explicit type as below:
Select convert(date, '13/11/2017',103)

Kannan Kandasamy
- 13,405
- 3
- 25
- 38
0
You souhld check the style parameter.
convert(data_type, expression, stlye)
In your case:
convert(date, '13/11/2017',103)
Most popular date conversions:
convert(date, 'dd/mm/yyyy', 103)
convert(date, 'mm/dd/yyyy', 101)
convert(date, 'dd-mm-yyyy', 105)
See more at: https://learn.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql

Prete
- 97
- 1
- 5