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

后端 未结 14 1795
梦谈多话
梦谈多话 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: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.

提交回复
热议问题