I have a date stored in varchar variable I want to covert it to datetime format so that I could update the date to a column with type datetime
declare @dt_original as varchar(30)
set @dt_original original='1997-12-22 00:00:00.000'
I have tried
cast(@dt_original as date time)
Convert(datetime,@dt_original)
But nothing worked
Always throwing "conversion failed when converting date and/or time from character string"
varchar
in the first place? – Larnuyyyy-dd-MM
. – Larnu