I have to develop system which is accept data (in database) from another system. The problem I face is all DATE and TIME data is in NVARCHAR
. I have to convert to DATE
and TIME
in order to calculate the duration. I am using SQL Server 2008 R2.
Data example:
STR_YMD STR_HMS
--------------------
20150101 151000
20090807 123009
20130113 145602
20090515 061700
How could I convert this data into following DATETIME
data?
STR_DT
--------------------
2015-01-01 15:10:00
2009-08-07 12:30:09
2013-01-13 14:56:02
2009-05-15 06:17:00
Hopefully someone could help me. Thanks in advance
Bet