| title | Delete a Trace (Transact-SQL) | |||
|---|---|---|---|---|
| description | Delete a Trace (Transact-SQL) | |||
| author | MashaMSFT | |||
| ms.author | mathoma | |||
| ms.date | 03/06/2017 | |||
| ms.service | sql | |||
| ms.topic | language-reference | |||
| helpviewer_keywords |
|
[!INCLUDE SQL Server] This topic describes how to use stored procedures to delete a trace.
For an example of using trace stored procedures, see Create a Trace (Transact-SQL).
-
Execute sp_trace_setstatus by specifying
@status = 0to stop the trace. -
Execute sp_trace_setstatus by specifying
@status = 2to close the trace and delete its information from the server.
Note
A trace must be stopped first before it can be closed.
sp_trace_setstatus (Transact-SQL)
System Stored Procedures (Transact-SQL)
SQL Server Profiler Stored Procedures (Transact-SQL)