syspolicy_policies (Transact-SQL)

 

Updated: June 10, 2016

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Displays one row for each Policy-Based Management policy in the instance of SQL Server. syspolicy_policies belongs to the dbo schema in the msdb database. The following table describes the columns in the syspolicy_policies view.

Column nameData typeDescription
policy_idintIdentifier of the policy.
namesysnameName of the policy.
condition_idintID of the condition enforced or tested by this policy.
root_condition_idintFor internal use only.
date_createddatetimeDate and time the policy was created.
execution_modeintEvaluation mode for the policy. Possible values are as follows:

0 = On demand

This mode evaluates the policy when directly specified by the user.

1 = On change: prevent

This automated mode uses DDL triggers to prevent policy violations.

2 = On change: log only

This automated mode uses event notification to evaluate a policy when a relevant change occurs and logs policy violations.

4 = On schedule

This automated mode uses a SQL Server Agent job to periodically evaluate a policy. The mode logs policy violations.

Note: The value 3 is not a possible value.
policy_categoryintID of the Policy-Based Management policy category that this policy belongs to. Is NULL if it is the default policy group.
schedule_uiduniqueidentifierWhen the execution_mode is On schedule, contains the ID of the schedule; otherwise, is NULL.
descriptionnvarchar(max)Description of the policy. The description column is optional and can be NULL.
help_textnvarchar(4000)The hyperlink text that belongs to help_link.
help_linknvarchar(2083)The additional help hyperlink that is assigned to the policy by the policy creator.
object_set_idintID of the object set that the policy evaluates.
is_enabledbitIndicates whether the policy is currently enabled (1) or disabled (0).
job_iduniqueidentifierWhen the execution_mode is On schedule, contains the ID of the SQL Server Agent job that runs the policy.
created_bysysnameLogin that created the policy.
modified_bysysnameLogin that most recently modified the policy. Is NULL if never modified.
date_modifieddatetimeDate and time the policy was created. Is NULL if never modified.

When you are troubleshooting Policy-Based Management, query the syspolicy_conditions view to determine whether the policy is enabled. This view also displays who created or last changed the policy.

Requires membership in the PolicyAdministratorRole role in the msdb database.

Administer Servers by Using Policy-Based Management
Policy-Based Management Views (Transact-SQL)

Community Additions

ADD
Show: