I have a varchar
column named [Dato Time]
which contains values like:
2011-05-12 00
2011-05-12 01
2011-05-12 02
So, a date and a Hour-specific time.
I would like to split the date and the time up in two columns, a column named [Dato]
with datatype date
and a column named Time
with datatype time(7)
.
I extracted the date-part with the following substring:
UPDATE Dato_Time SET [Dato] = SUBSTRING([Dato Time], 1, 10)
This worked without any problem. But when I try to run the same code for the time-part:
UPDATE Dato_Time SET [Time] = SUBSTRING([Dato Time], 12, 13)
It gives me the following error:
Conversion failed when converting date and/or time from character string.
Any ideas?