Sql-server – Use a condition to limit the databases a policy checks

sql serversql-server-2008-r2

I'd like to create a Policy that checks, on demand, one database in an instance for tables that have no index. I can see how to create a Condition, linked to the 'Database' Facet and checks for my database's GUID. I can also see how to create a Condition, linked to the 'Table' Facet that checks for the presence of an index. When I create a Policy, however, I seem to be able to only check one Condition. I know you can add clauses to Conditions, which would be fine if I didn't have to specify a Facet and so limit my options. Can you not have multiple Conditions in a Policy?

Best Answer

You can certainly limit the set of databases that are checked, using a condition, and have that condition be separate from the actual condition the policy is using to check. Pull down the "Every" drop-down in the UI:

enter image description here

Create a new condition:

enter image description here

Then you should be able to use that condition:

enter image description here

Note that this is using the SQL Server 2012 version of Management Studio (which is now completely free, as of SP1). If the UI does not behave this way in the 2008 R2 version of the tools, upgrade your tools.