I have a stock of scripted trace definitions that I use for different levels of diagnostics, none of which filter by HostName. I needed to filter traffic by host today so:
- Fired up Profiler
- Created an empty trace
- Added SP:Start/Complete
- Set a filter on hostname
- Scripted to test.sql file
Open file in SSMS, no sign of the filter. Rinse, repeat, same again. Assuming I was doing something daft I looked up the value to use (harder to find than it should be!) and added to my trace definition manually, which worked.
EXEC sp_trace_setfilter @TraceId, 8, 0, 6, N'MyHostName'
Came back to check on why I couldn't get this to work from Profiler and same result. I found mention of this being a problem when scripting traces for 2000 from SSMS but no mention of this situation with SSMS2005/2008 to 2005/2008 servers. Is this a bug in Profiler?