我正在尝试为用户分配安全性,但每次我尝试授予表值函数的权限时,都会收到错误:
键不能为空。
参数名称:key(mscorlib)
添加存储过程,视图或表时没有错误,并且使用T-SQL授予权限可以正常工作。我在同一服务器上的不同数据库和SQL Server 2016的两个实例上尝试过这种错误。
作为附注(可能相关),我在尝试通过 User>列出属于模式的所有对象时也遇到错误。 Securables>搜索>属于架构的所有对象。我选择哪个模式无关紧要,对话框以错误结束:
价值不在预期范围内。 (SqlMgmt)
更多信息:
“技术细节”按钮的堆栈跟踪:
===================================
Key cannot be null.
Parameter name: key (mscorlib)
------------------------------
Program Location:
at System.Collections.Hashtable.ContainsKey(Object key)
at System.Collections.Hashtable.Contains(Object key)
at System.Collections.Specialized.HybridDictionary.Contains(Object key)
at Microsoft.SqlServer.Management.SqlMgmt.PermissionsData.SecurableColumnParent.ApplyRevokes(SqlSmoObject obj)
at Microsoft.SqlServer.Management.SqlMgmt.PermissionsData.Principal.ApplyChanges(String principalName, Server server)
at Microsoft.SqlServer.Management.SqlMgmt.PermissionsDatabasePrincipal.OnRunNow(Object sender)
at Microsoft.SqlServer.Management.SqlMgmt.PanelExecutionHandler.Run(RunType runType, Object sender)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.DoPreProcessExecutionAndRunViews(RunType runType)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.ExecuteForSql(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.SqlMgmtTreeViewControl.Microsoft.SqlServer.Management.SqlMgmt.IExecutionAwareSqlControlCollection.PreProcessExecution(PreProcessExecutionInfo executionInfo, ExecutionMode& executionResult)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.RunNow(RunType runType, Object sender)