• Vitali Lisau (2/9/2009)


    The code is nice, but it actually shows only the records from the last trace file (SQL Srv 2005 Ent , SP2 and SP3).

    select * from sys.traces

    - returns the last trace file, e.g

    'E:\MSSQL\SystemData\MSSQL.1\MSSQL\LOG\log_734.trc'

    But ::fn_trace_gettable() - requires the first file name from the sequence.

    For example, if there are 5 files stored, then it is necessary to pass

    ('E:\MSSQL\SystemData\MSSQL.1\MSSQL\LOG\log_730.trc', 5)

    Otherwise, you will see info only from the last file.

    I also tried going back by passing the last file name and negative number of files(-3), but it did not work as desired - only the last log info was returned.

    You are correct that is a nice catch. This actual happens because Path actually includes the file number instead of the default name. I will correct the code to reflect this.