Using ::fn_trace_gettable To Load Trace Data

  • Is anyone familiar with a way to LOAD more than 1 flat/trace file into a table?  

    I've been using the following SQL to load a single trace file at a time

    SELECT * INTO TraceMon FROM ::fn_trace_gettable('T:\TRACE\HISTORY\flat_trace_file_01.trc', default)

    (I've been playing tricks to load the 2nd, 3rd, 4th.... flat files into temp tables then INSERTing the Temp table data into the actual base table but would prefer to be able to concatenate the actual flat files together)

    BT
  • This was removed by the editor as SPAM

  • Isn't you trace files sequential? otherwise you will have to make recursive operation like that:

    DECLARE @i INT
    SET @i = 0
    WHILE @i < 20 -- for example
    BEGIN
    
    INSERT INTO TraceMon (<Column Names&gt
    SELECT * FROM ::fn_trace_gettable('T:\TRACE\HISTORY\flat_trace_file_0' + @i + '.trc', default)
    SET @i = @i + 1

    END

    Hope this helps

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply