Skip to content

Latest commit

 

History

History
74 lines (55 loc) · 2.79 KB

kill-query-notification-subscription-transact-sql.md

File metadata and controls

74 lines (55 loc) · 2.79 KB
title titleSuffix description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
KILL QUERY NOTIFICATION SUBSCRIPTION
SQL Server (Transact-SQL)
Remove query notification subscriptions from an instance. This statement can remove a specific subscription or all subscriptions.
rwestMSFT
randolphwest
07/27/2017
sql
t-sql
reference
KILL QUERY NOTIFICATION SUBSCRIPTION
KILL_QUERY_NOTIFICATION_SUBSCRIPTION_TSQL
KILL QUERY NOTIFICATION SUBSCRIPTION statement
removing subscriptions
subscriptions [SQL Server query notifications], stopping
query notifications [SQL Server], subscriptions
TSQL

KILL QUERY NOTIFICATION SUBSCRIPTION (Transact-SQL)

[!INCLUDE SQL Server Azure SQL Managed Instance]

Removes query notification subscriptions from the instance. This statement can remove a specific subscription or all subscriptions.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

KILL QUERY NOTIFICATION SUBSCRIPTION   
   { ALL | subscription_id }  

[!INCLUDEsql-server-tsql-previous-offline-documentation]

Arguments

ALL
Removes all subscriptions in the instance.

subscription_id
Removes the subscription with the subscription id subscription_id.

Remarks

The KILL QUERY NOTIFICATION SUBSCRIPTION statement removes query notification subscriptions without producing a notification message.

subscription_id is the id for the subscription as shown in the dynamic management view sys.dm_qn_subscriptions (Transact-SQL).

If the specified subscription id does not exist, the statement produces an error.

Permissions

Permission to execute this statement is restricted to members of the sysadmin fixed server role.

Examples

A. Removing all query notification subscriptions in the instance

The following example removes all query notification subscriptions in the instance.

KILL QUERY NOTIFICATION SUBSCRIPTION ALL ;  

B. Removing a single query notification subscription

The following example removes the query notification subscription with the id 73.

KILL QUERY NOTIFICATION SUBSCRIPTION 73 ;  

See Also

sys.dm_qn_subscriptions (Transact-SQL)