FIX: Policy-Based Management policy isn't working after you install CU2 for SQL Server 2016 SP1

Applies to: SQL Server 2016 Service Pack 1SQL Server 2016 Enterprise CoreSQL Server 2016 Enterprise

Symptoms


Assume that you use the Policy-Based Management policy to manage Microsoft SQL Server 2016. After you install the Cumulative Update 2 (CU2) for SQL Server 2016 Service Pack 1 (SP1), the policy may function abnormally. For example, you have the policy to evaluate whether the name contains specific characters when you create a new stored procedure. After you install CU2, even if the name is valid, you may still not able to create the stored procedure, and you receive an error message that resembles the following:

Msg 515, Level 16, State 2, Procedure ProcedureName, Line LineNumber [Batch Start Line LineNumber ]

Cannot insert the value NULL into column 'target_query_expression', table 'msdb.dbo.syspolicy_policy_execution_history_details_internal'; column does not allow nulls. INSERT fails.

Resolution


This issue is fixed in the following cumulative updates for SQL Server:

       Cumulative Update 2 for SQL Server 2017

       Cumulative Update 6 for SQL Server 2016 SP1

Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Reference


Learn about the terminology that Microsoft uses to describe software updates.