-2

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.

Mulwaffer
  • 22
  • 4

2 Answers2

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