The following steps will guide you through a sample of Policy Based Management using SQL Server 2008. Here we will create a Table Naming Convention policy to enforce that the Table Name should start with “tbl” and will evaluate later.
Create the ‘Table Naming Convention’ condition
- In Object Explorer, expand Management, expand Policy Management, expand Facets, right-click Table, and then click New Condition
- In the Create New Condition dialog box, in the Name box, type Table starts with tbl lick
- In the Facet box, confirm that Table is selected.
- In Expression area, in the Field box, select @Name, in the Operator box select LIKE, and in the Value type “tbl%”
- Optionally, you can type a description of the condition, by clicking on the Description tab.
Create the ‘Table Naming Conventions’ policy
- In Object Explorer, right-click Policies, and then click New Policy
- In the Create New Policy dialog box, in the Name box, type Table Naming Conventions
- Select the Enabled box, to enable the policy
- In Against Targets, verify that Every Table in Every Database is selected.
- In Execution Mode, select On Change_Prevent
Evaluate the ‘Table Naming Conventions’ policy
- In Object Explorer, right-click Policies, and then click Evaluate
- A new dialogue box will pop-up showing the results against the Policy Evaluation