• in section 9

    -- 9 - Populate the #ParsedFileList table with the final data

    INSERT INTO #ParsedFileList

    (DateTimeStamp,

    LSN,

    FileSize,

    FileName1)

    SELECT LTRIM(SUBSTRING (Col1, 1, 20)) AS 'DateTimeStamp',

    LTRIM(SUBSTRING(Col1, 71, 6)) AS 'LSN',

    LTRIM(SUBSTRING (Col1, 21, 18)) AS 'FileSize',

    LTRIM(SUBSTRING (Col1, 40, 1000)) AS 'FileName1'

    FROM #OriginalFileList

    ORDER BY LSN

    comment out the INSERT part and run the query - instead of running the results into the table, it will return them to your screen. Check that column 1 values can be converted to date.

    “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