• Here's a couple of ideas.

    DECLARE @Now DATETIME

    SET @Now = GETDATE()

    SELECT @Now

    SELECT CAST(datepart(yy, @Now) AS CHAR(4)) +

    RIGHT('0'+LTRIM(cast(datepart(mm, @Now) as VARCHAR(2))), 2) +

    RIGHT('0'+LTRIM(cast(datepart(dd, @Now) as VARCHAR(2))), 2) +

    RIGHT('0'+LTRIM(cast(datepart(hh, @Now) as VARCHAR(2))), 2) +

    RIGHT('0'+LTRIM(cast(datepart(mm, @Now) as VARCHAR(2))), 2) +

    RIGHT('0'+LTRIM(cast(datepart(ss, @Now) as VARCHAR(2))), 2) +

    RIGHT('00'+LTRIM(cast(datepart(ms, @Now) as VARCHAR(3))), 3)

    SELECT REPLACE(REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(28), @Now, 121), '-', ''), ' ', ''), ':', ''), '.', '')

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden