GRANT EXECUTE ON SomeProc TO SomeRole AS dbo
2
votes
2
answers
8512
views
I have a role
ExecSP
which I use to manage who can execute stored procedures. EXECUTE
permission is granted on all SPs to this role.
I also use SQL Server Data Tools (SSDT) to manage MS SQL Server database schema.
In the file where my SP is defined, I have this:
CREATE PROC SomeProc AS
.
.
.
GO
GRANT EXECUTE ON SomeProc TO ExecSP
However, when I apply the change to the target database, and do the schema comparison, it reports differences in SP permissions, where on the DB side I have this:
GRANT EXECUTE ON SomeProc TO ExecSP AS dbo
I've [tried to understand](https://learn.microsoft.com/en-us/sql/t-sql/statements/grant-object-permissions-transact-sql) what AS dbo
part represents, but I couldn't.
My questions:
1. Does it mean that the SP will be executed with dbo
rights, regardless of who is executing it? (I guess/hope it doesn't.)
2. Why is this added automatically?
3. I want this SP to be executed with the rights the caller has - how do I achieve that?
Asked by Anil
(355 rep)
May 22, 2017, 07:38 AM
Last activity: Jun 24, 2025, 07:36 AM
Last activity: Jun 24, 2025, 07:36 AM