I have a table with a VARCHAR() column with values in this format:
2012-10-05T11:14:00-04:00
I need to put this data into another table where the data type of the field is DATETIME.
How would I go about converting
2012-10-05T11:14:00-04:00
to
2012-10-05 11:14:00
?
I tried:
CAST(LEFT(REPLACE(fieldtimestamp, 'T', ' '), 19) AS DATETIME)
But it keeps giving me the error:
Conversion failed when converting date and/or time from character string.
works for me giving
under sql server 2012