• I'm sorry if I'm not being clear but I can only see what I've already sent you, basically, when I run the following:

    -- 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

    I get the following error message:

    Msg 242, Level 16, State 3, Line 56

    The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

    The statement has been terminated.

    When change the conversion statement and run the following query:

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

    INSERT INTO #ParsedFileList

    (DateTimeStamp,

    LSN,

    FileSize,

    FileName1)

    SELECT

    CONVERT(DATE, CONVERT(CHAR(8), Col1)) 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

    I get the following error:

    Msg 241, Level 16, State 1, Line 56

    Conversion failed when converting date and/or time from character string.

    I'm sure it is an easy fix but I really cannot see where it is going wrong.

    Thank you again!