Shai Cohen
Shai Cohen

Reputation: 6249

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.

Upvotes: 0

Views: 4566

Answers (1)

Aaron Bertrand
Aaron Bertrand

Reputation: 280615

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.

Upvotes: 1

Related Questions