I need to convert a column that contains dates and times in the format 08-JAN-19 09.35.58.173000000 AM to datetime. I've included the code I've tried below - the code commented out is currently not working.
SELECT [last_updated_at]
, SUBSTRING([last_updated_at], 1, 9)
, convert(datetime, SUBSTRING([last_updated_at], 1, 9), 103) as Date
, SUBSTRING([last_updated_at], 11, 18)
--, convert(datetime, SUBSTRING([last_updated_at], 11, 18), 103) as Time --This fails
--, convert(datetime, SUBSTRING([last_updated_at], 1, 9), 103) + convert(datetime, SUBSTRING([last_updated_at], 11, 18), 103) as DateTime --final output datetime column
FROM #temp_dates