Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 stored procedure permissions issue

Author  Topic 

dmaxj
Posting Yak Master

174 Posts

Posted - 2008-12-18 : 14:09:37
I created a stored procedure on SQL Server 2005:
CREATE PROC uspReminderList AS 
SELECT......


I noticed that the procedure shows up with my domainName\myLoginName.uspReminderList under Stored Procedures. Next I go into Visual Studio and use the Server explorer to browse to my Stored Procedures on the same server. My stored procedure does not show up. I think that the problem is with the permissions of my stored procedure when I created it. Is there a way to change the permissions of my current procedure (uspReminderList) to dbo, so that my web server can access stored procedures on my SQL Server?

I am thinking that I could ALTER PROC but not sure after that. I thought of copying my my SELECT statement again in a new CREATE PROC, but not sure how to set dbo instead of just my domain name. I hope I posted this in the right place ( and that I am making sense).

Regards!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-18 : 14:22:25
CREATE PROC dbo.uspReminderList
AS
...

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-12-18 : 14:23:15
exec sp_changeObjectOwner '[<domain>\<login>].uspReminderList', dbo

you should use: CREATE PROC dbo.<spName>

Be One with the Optimizer
TG
Go to Top of Page

dmaxj
Posting Yak Master

174 Posts

Posted - 2008-12-18 : 15:26:31
Thanks to all - worked like a charm... I was able to create a new procedure and I was able to change the owner of the existing script.

However, I do have more to ask. I have an active directory group that I only want to access the stored procedure in the database from the web server. So I decided to try this:

CREATE PROC SQLWeb.uspReminderList AS
SELECT...


I get this error - The specified schema name "SQLWeb" either does not exist or you do not have permission to use it.

Well the AD group exist with my domain name in the group.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-18 : 15:30:58
You should just use dbo, and then grant the group execute permission to the stored procedure:

GRANT EXEC ON dbo.uspReminderList TO SQLWeb

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -