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.