Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 2.1 KB

sp-syspolicy-unsubscribe-from-policy-category-transact-sql.md

File metadata and controls

70 lines (50 loc) · 2.1 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_syspolicy_unsubscribe_from_policy_category (Transact-SQL)
Deletes a policy category subscription for the current database.
VanMSFT
vanto
randolphwest
06/26/2023
sql
system-objects
reference
sp_syspolicy_unsubscribe_from_policy_category_TSQL
sp_syspolicy_unsubscribe_from_policy_category
sp_syspolicy_unsubscribe_from_policy_category
TSQL

sp_syspolicy_unsubscribe_from_policy_category (Transact-SQL)

[!INCLUDE SQL Server]

Deletes a policy category subscription for the current database.

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

Syntax

sp_syspolicy_unsubscribe_from_policy_category
    [ @policy_category = ] N'policy_category'
[ ; ]

Arguments

[ @policy_category = ] N'policy_category'

The name of the policy category subscription that you want to delete. policy_category is sysname, and is required.

To obtain values for @policy_category, query the msdb.dbo.syspolicy_policy_categories system view.

Return code values

0 (success) or 1 (failure).

Remarks

You must run sp_syspolicy_unsubscribe_from_policy_category in the context of the database where you want to remove a policy category subscription.

Permissions

Requires membership in the db_owner fixed database role.

Examples

The following example deletes a subscription to the Finance policy category for the specified database.

USE <database_name>;
GO
EXEC sys.sp_syspolicy_unsubscribe_from_policy_category
    @policy_category = N'Finance';
GO

Related content