如:2014-11-17 08:50:59.803这样的格式
------解决思路----------------------
DECLARE @STR VARCHAR(20)直接字符串处理,或者写个函数包装处理了下
SET @STR='20150302123426000'
SELECT CAST(LEFT(@STR,8)+' '+SUBSTRING(@STR,9,2)+':'+SUBSTRING(@STR,11,2)+':'+SUBSTRING(@STR,13,2)+'.'+SUBSTRING(@STR,15,3)AS DATETIME)
------解决思路----------------------
你这个只能这样了:
select left('20150302123426000',4)+'-'+substring('20150302123426000',5,2)+'-'
+substring('20150302123426000',7,2)+' '+substring('20150302123426000',9,2)+':'+substring('20150302123426000',11,2)+':'
+substring('20150302123426000',13,2)+'.'+substring('20150302123426000',15,3)