KILL QUERY NOTIFICATION SUBSCRIPTION (Transact-SQL)
Applies To: SQL Server 2014, SQL Server 2016 Preview
Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).
Removes query notification subscriptions from the instance. This statement can remove a specific subscription or all subscriptions.
Applies to: SQL Server (SQL Server 2008 through current version).
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.
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 ;