Search code examples
sql-server-2008database-permissions

Do I need to grant EXECUTE rights on a function that is called from a stored procedure?


I have a SQL function that is only called from inside another stored procedure. I have granted EXECUTE rights for the stored procedure that calls the function.

Do I need to grant EXECUTE permissions to the function as well?

EDIT

In response to the comment from @AaronBertrand

The function does not access any other objects in the database. It is used to build a string.


Solution

  • If the problem is that your user can't execute it, try dropping and re-creating the function, and applying the appropriate permissions on the function itself and any object(s) it references. There may be a DENY hanging around, which will always trump GRANT.