다음을 통해 공유


СТР 3: Declarative Management framework. Пример

??????? ??????? ??????: ?????????? ????????? ??? ????? ??????, ??????? ?????????? ?? Test.

??? ????? ?????????? ??????? ??????? , ??????? ????? ?????????: ??? ??????? ?? ????? «Test%».

??? ????? ? Management Studio:

1. ???? ? Policy Management, ?????? ??????? ??????? ?? Conditions ? ???????: New Condition.

2. ? ??????????? ???? Create New Condition ? ???? Name ???????: Table Name Condition .

3. ? ???? Facet ???????? Multipart Name Facet.

4. ? ???? ??????? ??????? (Expression) ? Field ????????: Name;

? ???? Operator: NOT Like; ? ???? Value ????? Test%

? ???? ???????? ????? ???????: The table name should not start with Test

????? ?????????? ??????? ???????? :

1. ? ???????????? Object Explorer ??????? ?????? ??????? ?? Policies ? ???????? New Policy.

2. ? ???? Create New Policy ???????? ??? ??? ????????, ????: Table Name Policy,

3. ?????? ??????? ?? «Enabled»

4.  ? ???? Condition box ???????? Table Name Condition.

5. ?????? ????? ???????? “Default”.

6. ? ???? Applies to: ??????? ?? ????? ?????? Server/Database/Table.

7. ? ???????? ?????? ??????????: Enforce

?????? ? QA ??????? ??????:

create table Test (Name nvarchar (10))

Policy 'Table Name Policy' has been violated by 'Server/Database[@Name='master']/Table[@Name='Test' and @Schema='dbo']'. This transaction will be rolled back.

Msg 3609, Level 16, State 1, Procedure sp_syspolicy_dispatch_event, Line 88

The transaction ended in the trigger. The batch has been aborted.

 

??? ? ??????????? ????????.

???????? ?? ?????? ? ??????? ??????????? ???????? ?????????.

P.S ?????? ??? ??????????? DMF ???????? ????????: ??? ?????? ??? ? ???, ??????? ????? ?????? ?? ??? ??? ??????? ??????? ???????. ??? ??? ???? ?????? ??????? ???:

https://sqlserver-qa.net/blogs/sql2008/archive/2007/06/10/653.aspx