A union of curiosity and data science

Knowledgebase and brain dump of a database engineer

Useful Profiler T-SQL functions

Query an individual trace file:

SELECT top 10
::fn_trace_gettable('<drive><path><file>.trc', default)

Gather Information about running traces:

SELECT * FROM fn_trace_getinfo(null)


Stop a trace:

-- Stop a trace. Get the trace ID from the above query
master..sp_trace_setstatus @traceid = ? ,@status = 0

 -- Removes a trace definition completely
master..sp_trace_setstatus @traceid = ? ,@status = 2