error when assigning a database role to table-valued function RRS feed

  • Question

  • Hello,

    How I can learn more about what is causing this error?  I am using SQL server 2012 and am able to assign scaler-valued functions to database roles but when I add any table valued function and assign the select permission this error pops up.  

    error detail:

    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)

    Monday, May 22, 2017 2:18 PM

All replies

  • Rather than using point-and-click, just type

     GRANT SELECT ON dbo.mytablefun TO thatroleoverthere

    If you really want to use the UI, please post the version number from Help->About in SSMS.

    Monday, May 22, 2017 9:47 PM
  • Hi devtycoon,

    That certainly sounds like SSMS issue to me, and you should be able to work around it by using T-SQL as Erland suggested. Also, if you are running earlier versions of SSMS, I’d suggest you switch to latest release(if possible) as it contains many fixes and new features.

    If you have any other questions, please let me know.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 23, 2017 5:14 AM