In my table values are saved as Thursday November 12, 2020 07:01. I want to convert those values to the date time. This is the query which I wrote.
select
convert(varchar(200), replace(replace(replace(replace(replace(replace(replace(publishedon,'Monday',''),'Saturday',''),'Sunday',''),'Tuesday',''),'Wednesday',''),'Thursday',''),'Friday',''))
from py_EconNext
Once I removed the days from the values, I can get values as November 12, 2020 11:04. After that I try to convert it to datetime. When converting this to the datetime, I’m getting the error
Conversion failed when converting date and/or time from character string.
But when I run select as below
select convert(datetime,convert(varchar(200),(' November 12, 2020 11:04')))
I can get the values as 2020-11-12 11:04:00.000 without any error.
Table column datatype - varchar(200)