Renaming a policy

Peter Schmitz

Administrator
Staff member
Today, I needed to rename a policy in SQL Server Management Studio (SSMS). However, it is not possible to do so using the GUI for some reason.

The usual tricks to rename objects (highlighting the object and pressing F2, or right-clicking the object and selecting "Rename" from the drop-down menu) did not work, so I was about to just delete and recreate the policy.

Before doing so, though, I figured I would try and spend a few minutes to see if there was an easier way to accomplish the goal. And as it turns out, there is.

The names of the policies are stored in the msdb database, particularly in the dbo.syspolicy_policies_internal table. To rename the policy, use the following query:

Code:
UPDATE 
    msdb.dbo.syspolicy_policies_internal
SET name = '<new name>'
WHERE name = '<old name>'

Obviously, replace <new name> and <old name> with your own values.
 
Top