Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

DROP EVENT SESSION (Transact-SQL)

Applies to: 👁 Image
SQL Server 👁 Image
Azure SQL Managed Instance

Drops an event session.

👁 Image
Transact-SQL syntax conventions

Syntax

DROP EVENT SESSION event_session_name
ON { SERVER | DATABASE }

Arguments

event_session_name

The name of an existing event session.

Remarks

When you drop an event session, all configuration information, such as targets and session parameters, is completely removed.

Permissions

SQL Server and Azure SQL Managed Instance require the DROP ANY EVENT SESSION (introduced in SQL Server 2022), or ALTER ANY EVENT SESSION permission.

Azure SQL Database requires the DROP ANY DATABASE EVENT SESSION permission in the database.

Tip

SQL Server 2022 introduced more granular permissions for Extended Events. For more information, see Blog: New granular permissions for SQL Server 2022 and Azure SQL to improve adherence with PoLP.

Examples

The following example shows how to drop an event session. To use this example with database event sessions, replace ON SERVER with ON DATABASE.

DROP EVENT SESSION test_session ON SERVER;

Related content


Feedback

Was this page helpful?

Additional resources