SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


EXECUTE permission was denied


EXECUTE permission was denied

Author
Message
Mani-584606
Mani-584606
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1056 Visits: 1998
Developer getting EXECUTE permission was denied error as below:

Msg 229, Level 14, State 5, Line 2
The EXECUTE permission was denied on the object 'myobject', database 'Mydb', schema 'Myschema'.

I tried to find the object in Mydb database but I did not find it. How to find that object, what it is and grant execute permission?
Lowell
Lowell
One Orange Chip
One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)

Group: General Forum Members
Points: 28030 Visits: 39925
Mani I know you obfuscated the error, but i'll bet you an internet cookie that the procedure being called references a different database or different schema than what the procedure belongs to.

it sounds like ownership chaining is being broken to me.

for example, if dbo.myprocedure , which exists in the database [SandBox], references ANY OTHER database, the calling user will get the error you describe.the same can happen if it references a different schema, like [SandBox].Finance.Tablename instead of [SandBox].dbo.Tablename, but that's a little rarer to encounter in my experience; most places avoid multiple schemas.

Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Tony Sweet
Tony Sweet
Valued Member
Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)Valued Member (71 reputation)

Group: General Forum Members
Points: 71 Visits: 66
I tried to find the object in Mydb database but I did not find it. How to find that object, what it is and grant execute permission?


If you cant see it you probably do not have access to it. You will need to get someone with db_owner or sysadmin or something like that to find the object if you can not find it. Then grant the developer access to run it.

USE AdventureWorks2012; 
GRANT EXECUTE ON OBJECT::HumanResources.uspUpdateEmployeeHireInfo
TO Recruiting11;
GO



- Tony Sweet
Brandie Tarvin
Brandie Tarvin
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14446 Visits: 8989
If the error is happening because a proc is called inside another proc (or something like that) and you have permissions to see the proc, running this little code snippet might help:


EXECUTE sp_MSforeachdb @Command1 = 'SELECT DB_NAME() AS DatabaseName, name AS ProcName FROM sys.objects WHERE name = ''MyProc''';



This assumes the proc is on the same Instance, not being referenced by a linked server.

Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search