Whether you use bummi's STUFF
method or continue using SUBSTRING
, you're going to have to pre-format the string no matter what you do.
In this case, SUBSTRING
will perform a bit faster
SELECT CONVERT(date, SUBSTRING('20130909132512', 0, 9), 20)
You'll want to use "20" as the conversion style, though, if you want the date in the format 2013-09-09.