The EXECUTE permission was denied on the object 'xxxxxxx', database 'zzzzzzz', schema 'dbo'

后端 未结 14 1784
梦谈多话
梦谈多话 2020-12-02 05:18

I\'m having problems executing a function.

Here\'s what I did:

  1. Create a function using SQL Server Management Studio. It was successfully created.
相关标签:
14条回答
  • 2020-12-02 05:34

    If you make this user especial for a specific database, then maybe you do not set it as db_owner in "user mapping" of properties

    0 讨论(0)
  • 2020-12-02 05:35

    Best solution that i found is create a new database role i.e.

    CREATE ROLE db_executor;
    

    and then grant that role exec permission.

    GRANT EXECUTE TO db_executor;
    

    Now when you go to the properties of the user and go to User Mapping and select the database where you have added new role,now new role will be visible in the Database role membership for: section

    For more detail read full article

    0 讨论(0)
  • 2020-12-02 05:37

    You don't have the right to execute it, although you have enough permissions to create it.

    For more information, see GRANT Object Permissions (Transact-SQL)

    0 讨论(0)
  • 2020-12-02 05:38

    you need to run something like this

    GRANT Execute ON [dbo].fnc_whatEver TO [domain\user]
    
    0 讨论(0)
  • 2020-12-02 05:38

    Giving such permission can be dangerous, especially if your web application uses that same username.

    Now the web user (and the whole world wide web) also has the permission to create and drop objects within your database. Think SQL Injection!

    I recommend granting Execute privileges only to the specific user on the given object as follows:

    grant execute on storedProcedureNameNoquotes to myusernameNoquotes
    

    Now the user myusernameNoquotes can execute procedure storedProcedureNameNoquotes without other unnecessary permissions to your valuable data.

    0 讨论(0)
  • 2020-12-02 05:41

    This will work if you are trying to Grant permission to Users or roles.

    Using Microsoft SQL Server Management Studio:

    1. Go to: Databases
    2. Right click on dbo.my_database
    3. Choose: Properties
    4. On the left side panel, click on: Permissions
    5. Select the User or Role and in the Name Panel
    6. Find Execute in in permissions and checkmark: Grant,With Grant, or Deny
    0 讨论(0)
提交回复
热议问题