Solved

Stored Procedure Permissions

Posted on 2004-08-05
14
483 Views
Last Modified: 2010-08-05
This is my first time creating a stored procedure.  I basically copied another and tweaked it to my needs.  What I found however is that I didn't set the permissions on it so therefore my ASP page produces this error when I try to submit the form data to the database:

EXECUTE permission denied on object 'sp_myprocedurename, database 'Test', owner 'dbo'

I am not sure what type of access is setup.  I am very familiar with creating logins in SQL Server EM but not sure if we're really using that type of authentification...or even if I do create a login, I don't even see a list of stored procedures, just the ability to give dbowner rights and such to databases.
0
Comment
Question by:dba123
  • 7
  • 6
14 Comments
 
LVL 9

Expert Comment

by:crescendo
ID: 11731477
You need to run this in Query Analyser:

    GRANT EXCUTE ON sproc_name TO ASPNET_account

where sproc_name is the name of the sproc (obviously) and ASPNET_account is the SQL user corresponding to the Windows user running ASP.NET, usually ASPNET.
0
 
LVL 9

Expert Comment

by:crescendo
ID: 11731481
Sorry, can't type/spell

    GRANT EXECUTE ON sproc_name TO ASPNET_account
0
 
LVL 9

Expert Comment

by:crescendo
ID: 11731486
If the names in the error message are real, you need

    GRANT EXECUTE ON Test.dbo.sp_myprocedurename TO ASPNET_account

just putting in your ASPNET_account
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:dba123
ID: 11731503
We dont use .Net...does that make a diff?
0
 
LVL 18

Expert Comment

by:SjoerdVerweij
ID: 11731513
Not really. Find out what account IIS is running as (Administrative Tools -> Services -> World Wide Web), find out what login that is on the SQL Server, and then replace ASPNET_account above with that.
0
 
LVL 9

Expert Comment

by:crescendo
ID: 11731522
No, just use whatever user you want to give the permissions to. : )

0
 
LVL 9

Expert Comment

by:crescendo
ID: 11731528
It's probably IUSR_SERVERNAME

where SERVERNAME is the name of the web server.
0
 
LVL 1

Author Comment

by:dba123
ID: 11731538
what is IUSER ?
0
 
LVL 1

Author Comment

by:dba123
ID: 11731561
our servername has dashes in it so it didn't like that syntax  IUSR_ddd-ddd-dddd

I want to find out what IUSR is first to be safe...not familiar with it
0
 
LVL 9

Accepted Solution

by:
crescendo earned 500 total points
ID: 11731606
IIS, the web server, creates a windows user account to run as, usually called IUSR_<the name of the server>, for example, IUSER_DEV02. You can find out who it is in the Internet Services Manager administrative tool, by looking at the properties for a web site, going to the Directory Security tab, clicking Edit, then clicking Edit on the next dialog box.

The important thing however, from your question, is that you need to grant execute permission to the right users on your SQL box. Go into Enterprise Manager, open up the Security folder, then the Logins folder. On the right you will see all the users. Their names are what you put in that GRANT command I gave you.

If you use Enterprise Manager you can set the permissions there just as easily. Find the stored procedure (look in the database you used) and double-click on its name on the right-hand window. Click on the Permissions button and you can then just tick the boxes for the users you want to run the stored procedure.
0
 
LVL 1

Author Comment

by:dba123
ID: 11731654
Yea, I am familiar with Logins like I said.  But as far as I see I only see myself and a few other coders as users in logins.
0
 
LVL 1

Author Comment

by:dba123
ID: 11731656
thanks for the last and first tip....will check out the last one
0
 
LVL 1

Author Comment

by:dba123
ID: 11731662
ahhh, thank you so much for helping me remember.  I forgot that you can do that directly using the permissions button of a sp

thanks! it worked.
0
 
LVL 9

Expert Comment

by:crescendo
ID: 11731671
No problems, glad to help.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question