DECLARE @datetime_string varchar(30)
SET @datetime_string = '20160102201522'
SELECT CAST(STUFF(STUFF(STUFF(@datetime_string, 13, 0, ':'), 11, 0, ':'), 9, 0, ' ') AS datetime) AS datetime_value
2 Likes
DECLARE @datetime_string varchar(30)
SET @datetime_string = '20160102201522'
SELECT CAST(STUFF(STUFF(STUFF(@datetime_string, 13, 0, ':'), 11, 0, ':'), 9, 0, ' ') AS datetime) AS datetime_value