SQL Server – How to Select Only One Database in a Policy

policy-based-managementsql server

I am creating a new policy which shows sproc creation dates. I am based on Stored Procedure facet and appropriate condition is created. Now I want this policy to include only one database in an instance

enter image description here

When I select new policy from the dropdown menu, which is next to every keyword, it shows this

enter image description here

But my point is not to create a new condition for all databases.

My question is, is it possible to to run a policy only for one database in an instance, and if yes, then how?

Thanks for your time!

Best Answer

Policies are server-wide. But you can have a condition to only bother about the policy based on, for instance, the database name. And that is exactly what that condition that you were about to create would do. So keep creating that for the database name that is relevant for you and you have achieved what you want to achieve.

enter image description here