When the script is generated in Profiler 2005, the default value saved for the logical operator is 1='OR', so the trace will capture more information than we initially intended.
exec sp_trace_setfilter @TraceID, 8, 1, 0, N'HOSTNAME1' -- OR
exec sp_trace_setfilter @TraceID, 8, 1, 0, N'HOSTNAME2'
exec sp_trace_setfilter @TraceID, 8, 1, 0, N'HOSTNAME3'
set @bigintfilter = 10 -- reads >= 10
exec sp_trace_setfilter @TraceID, 16, 0, 4, @bigintfilter -- AND
exec sp_trace_setfilter @TraceID, 35, 1, 6, N'DB' -- OR
In Profiler >=2008, the script has 0(AND) for the first occurrence of the column being filtered.
exec sp_trace_setfilter @TraceID, 8, 0, 0, N'HOSTNAME1' -- AND
exec sp_trace_setfilter @TraceID, 8, 1, 0, N'HOSTNAME2'
exec sp_trace_setfilter @TraceID, 8, 1, 0, N'HOSTNAME3'
exec sp_trace_setfilter @TraceID, 35,0, 6, N'DB' -- AND
set @bigintfilter = 10 -- reads
exec sp_trace_setfilter @TraceID, 16, 0, 4, @bigintfilter -- AND
This looks like a bug in Profiler 2005.
Are you using one of the default traces in Profiler or are you creating it manually?
If I were in the same situation, I would just save the trace to a regular text file and then import that file into a SQL Server table.
USE mydb
GO
SELECT * INTO mytracetable FROM ::fn_trace_gettable('c:\my_trace.trc', default)
GO
At least that way you are certain to get the same columns everytime. As to the BULK INSERT statements, you could try this filter.
Column Filter for TextData with the Not Like set to %BULK INSERT%.
Best Answer
Laerte Junior has a nice article on how to read these using Powershell. Go down to the "Reading Multiple Trace Files and Insert into SQL table." section for the exact statement.