Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Policies and Conditions

Author  Topic 

TexMax007
Starting Member

5 Posts

Posted - 2009-12-11 : 11:28:30
Hello all,

I'm attempting to make a policy that will prevent users from creating a table that doesn't have "tbl_" at the beginning of the name.

I would like to use the evaluation mode: "On Change - Prevent" that I've read about online, but it is not a choice in the drop-down box when I'm creating the policy.

I'm using SQL Server 2008 Enterprise running on Windows Server 2008 R2.

Any ideas?

Thanks,

Max

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-12-11 : 11:32:37
Why?

Show me a developer or dba that can't quickly point out the tables in any script and I'll come over and turn off their database access for you
Go to Top of Page

TexMax007
Starting Member

5 Posts

Posted - 2009-12-11 : 11:49:31
Okay, well I'm very new at this and the policy that I was talking about is merely for learning purposes / proof of concept.

My main concern, which you didn't even bother to attempt to answer, was why the "On Change - Prevent" selection was missing from the "Evaluation Mode" drop down box where you create a policy.

What I'm trying to do may be the wrong way to go about it or unneccessary, but I would still like to know how to do it.

Thank you.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-12-11 : 12:22:58
Are nested triggers enabled? What steps did you take to create the condition and policy?

Have you read this? http://technet.microsoft.com/en-us/library/bb510667.aspx
Go to Top of Page

TexMax007
Starting Member

5 Posts

Posted - 2009-12-11 : 13:19:19
Nested Triggers are enabled.

I've read the link you posted and came accross this statement which I don't fully understand:

"Facets support On change: prevent if there is transactional support for the DDL statements that change the facet state."

Below are the steps I was doing to create my policy:

1) Create a new condition by right-clicking on 'conditions' under the management folder in Microsoft SQL Server Management Studio.

2) I gave the condition a name, for example: "Organize_Tables".

3) I chose the facet 'Table' from the drop-down box labeled 'Facet'.

4) I put '@Name' in the field called 'field'.

5) In the 'operator' field, I put 'LIKE'.

6) In the 'value' field I put ' 'tbl_%' '

7) Clicked 'OK'.

8) Right-clicked on Policies to create a new policy.

9) Named the policy for example: "Organize_Tables_Policy"

10) I chose the condition I just made from the drop-down box called 'Check Condition'.

11) I then went to change evaluation mode to 'On Change - Prevent' on the evaluation mode drop-down box, but it's not a choice.

12) Server restriction is None.

So, I'm running into problems on step 11.

I was following the tutorial provided on this website: http://www.mssqltips.com/tip.asp?tip=1492

Towards the bottom, it goes over the 'On Change - Prevent' , which is what I was trying to emmulate.

Any further assistance with this would be greatly appreciated.

Thanks.
Go to Top of Page
   

- Advertisement -