My goal is to write a script which:
- Creates a stored procedure
- Grants execution permissions to a particular user on that new stored procedure
On this SO question the recommendation is to add
GRANT EXECUTE ON at the end of a script that creates a stored procedure.
However, a permissions issue not letting my own non-admin account to grant permissions on stored procedures trying to execute the stored procedure lead me to believe that that
GRANT EXECUTE ON statement is executed each time that the stored procedure above it is executed. Am I incorrect?
Edit with clarification:
In the script involved, the stored procedure statements included
END, and was followed by
GO, before the
GRANT EXECUTE statement.