sp_syspolicy_update_policy_category_subscription (Transact-SQL)
Updates a policy category subscription for a specified database.
You must run sp_syspolicy_update_policy_category_subscription in the context of the msdb system database.
To obtain values for policy_category_subscription_id and for policy_category, you can use the following query:
SELECT a.policy_category_subscription_id, a.target_type, a.target_object
, b.name AS policy_category
FROM msdb.dbo.syspolicy_policy_category_subscriptions AS a
INNER JOIN msdb.dbo.syspolicy_policy_categories AS b
ON a.policy_category_id = b.policy_category_id;
Requires membership in the PolicyAdministratorRole fixed database role.
Security Note
|
|---|
|
Possible elevation of credentials: Users in the PolicyAdministratorRole role can create server triggers and schedule policy executions that can affect the operation of the instance of the Database Engine. For example, users in the PolicyAdministratorRole role can create a policy that can prevent most objects from being created in the Database Engine. Because of this possible elevation of credentials, the PolicyAdministratorRole role should be granted only to users who are trusted with controlling the configuration of the Database Engine. |
The following example updates an existing policy category subscription so that the AdventureWorks2012 database subscribes to the 'Finance' policy category.
EXEC msdb.dbo.sp_syspolicy_update_policy_category_subscription @policy_category_subscription_id = 1 , @target_object = 'AdventureWorks2012' , @policy_category = 'Finance'; GO
