I have a varchar column has data like (2015-12-02 20:40:37.8130000) which i have imported from csv file to SQL table. i need to convert this column to datatime as (2013-03-17 14:15:49.687).
ALTER TABLE track_date alter column start_time datetime.
getting error as :
Msg 241, Level 16, State 1, Line 1 Conversion failed when converting date and/or time from character string.
while converting using convert function , getting same error:
SELECT convert(datetime,start_time,5) from track_date
Msg 241, Level 16, State 1, Line 1 Conversion failed when converting date and/or time from character string.
Can you please help, how to convert this varchar data to datetime format?
datetime
(which does not have a format)? Or are you trying to end up with avarchar
that is just in a different format?