Sign in with Microsoft
Sign in or create an account.
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.


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.


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

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:

Latest cumulative update for SQL Server 2017

Latest cumulative updates for SQL Server 2016

More information

See Administer Servers by Using Policy-Based Management.


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


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

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!