Table valued parameter in a stored procedure gets execute permissions denied error

后端 未结 3 581
太阳男子
太阳男子 2021-01-07 18:33

I get the following error when calling a stored procedure that has a table valued parameter as one of the parameters

The EXECUTE permission was denied

3条回答
  •  执笔经年
    2021-01-07 18:54

    I think you may also need to grant the user permissions to the type.

    References for GRANTing permissions to types:
    SQL 2005
    SQL 2008

    Update:
    Re: why you have to grant permissions on the type when you have permissions on the sproc. I don't know the definitive reason, but BOL says:

    Unlike user-defined types created by using sp_addtype, the public database role is not automatically granted REFERENCES permission on types that are created by using CREATE TYPE. This permission must be granted separately.

    Update 2: To GRANT EXECUTE permissions, you'd run this in SSMS:

    GRANT EXECUTE ON TYPE::dbo.ValidationErrors TO SomeUser;
    

提交回复
热议问题