I am in the process of importing 200+ trace files (which are massive), and my current approach is to perform a loop and insert the trace data (see the below script). I looked around to see if there was a faster way to do this, whether through SSIS or C# and it appears that they still call the below function, similar to the script below this.
Anyone have any other methods that they use to import multiple traces? Don't get me wrong, the below code works, but I'm curious if there's something faster that I'm not considering.
DECLARE @start INT = 1, @stop INT = 223, @sql NVARCHAR(MAX), @path VARCHAR(1000) WHILE @start <= @stop BEGIN SET @path = 'N:\Traces\TraceFile_' + CAST(@start AS VARCHAR(5)) + '.trc' SET @sql = 'INSERT INTO SavedTraces SELECT * FROM ::fn_trace_gettable(''' + @path + ''', default) ' EXECUTE sp_executesql @sql SET @start = @start + 1 SET @path = '' SET @sql = '' END
Data Notes: 490MB (~.5G), which holds 11,700,000+ rows, requires 13:11 minutes to import.