I am trying to convert two types of string to a date format, but not able to do either of them.
The problematic input lines with the expected output are as follows:
Entrance 1: 20100614191522
Expected Result 1: 12/14/2010 7:15:22 PM
Entrance 2: 2010/12
Expected Result 2: 12/1/2010 12:00:00 AM
I tried,
select convert(datetime,'20100614191522',109)
I tried with various style options with the "convert" function. But I always get the following errors. Syntax error when explicitly converting the VARCHAR value '20100614191522' to the DATETIME field. Msg: 249, Level: 16, Condition: 1
Could you help me how to achieve the same.
Thanks in advance.