2012-07-11 41 views
0

我想在sql中创建一个策略,将sproc限制为命名约定。sp_execute_policy SQL中的错误,如何创建SQL方面策略

当有人创建一个新的存储过程,他们将被迫与sp_

像前缀的存储过程 - sp_MySprocName

但是当我尝试使用正确的命名约定创建新的sproc时,我收到了以下错误。

当我右键点击政策,并选择我的政策我点击Evaluate选项,一切运行得很好,不像当我实际上创建一个新的sproc我得到这个错误。

Msg 6522, Level 16, State 1, Procedure sp_execute_policy, Line 0 
A .NET Framework error occurred during execution of user-defined routine or aggregate "sp_execute_policy": 
System.TypeInitializationException: The type initializer for 'Microsoft.SqlServer.Management.Dmf.PolicyEvaluationHelper' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.Diagnostics.STrace, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified. 
System.IO.FileNotFoundException: 
at Microsoft.SqlServer.Management.Dmf.PolicyEvaluationHelper..cctor() 
System.TypeInitializationException: 
at Microsoft.SqlServer.Management.Dmf.PolicyEvaluationHelper.EvaluateAutomatedPolicy(String policy, SqlXml eventData, Int64& historyId) 
at Microsoft.SqlServer.Management.Dmf.PolicyEvaluationWrapper.EvaluateAutomatedPolicy(String policy, SqlXml eventData, Int64& historyId) 

Screen Shot Of Condition And Error

什么我需要做的就是这个错误的拼车?

我已将存储过程更新为proc_的前缀。现在他们是proc_MyProcedure

我仍然收到相同的错误。

有什么建议吗?

+1

让它们前面加上一个存储过程以sp_是执行一个不好的做法,解决了这一问题。如果有的话,你应该写一个禁止的政策。 – podiluska 2012-07-11 07:51:23

回答

0

基本上问题是microsoft.sqlserver.diadnostics.strace.dll未安装在GAC中。此外,该文件不在我的服务器上,也不在安装DVD上,所以我无法安装它。我在家里的个人电脑上发现了它,但有一个窍门可以到达我的工作服务器。

我相信,我已经通过复制

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.SqlServer.Diagnostics.STrace to C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSSHell\Common7\IDE