|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Friday, June 17, 2011 10:05 AM
Points: 85,
Visits: 394
|
|
On a development server, we have users who need to be able to modify, execute and view properties of stored procedures. I have tried combinations of permissions such as Alter, Control and View but when they try to view the properties, they receive the following error message:
Property Default Schema is not available for Database "[database_name]". This property may not exist for the object, or may not be retrievable due to insufficient access rights.
Is there some combination aside from sysadmin that allows viewing stored procedure properties?
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Wednesday, March 27, 2013 9:32 AM
Points: 336,
Visits: 152
|
|
Generally, SPs need to be given EXEC permission for those who need to run the SPs.
For this, permission will be provided after creating / altering the SPs like
GRANT EXEC on
- Here PUBLIC can be used to provide EXEC permission to ALL who have access permission to the DB / Server.
You can give the specific permission for the User using:
GRANT
Regards, Suresh
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Yesterday @ 3:22 AM
Points: 4,218,
Visits: 3,875
|
|
First of all I think you will get better response if you post a 2005 question in the appropriate forum.
Now to your question. There are a couple od roles which by default can view properties of a stored procedure. Sysadmin will work, but is total overkill. db_owner or ddl_admin would be a much better choice. GRANT VIEW DEFINITION will also work. But keep in mind that it's not possible to grant any this permission on one specific procedure. The grantee will be able to see definition and properties of all database objects.
Markus Bohse
|
|
|
|
|
SSC-Dedicated
           
Group: Administrators
Last Login: Today @ 3:26 PM
Points: 31,425,
Visits: 13,738
|
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Yesterday @ 7:52 AM
Points: 3,280,
Visits: 6,622
|
|
I think even a db_owner is an overkill. What I would suggest is to create a Role with the ddl_Admin as the rights to that particular DB and add the developers who need access to compile Stored procs to that role. If I was in your shoes, I would never give a Developer access to even read data (forget compiling Stored proc ) to a developer in the production Environment.
-Roy
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Friday, June 17, 2011 10:05 AM
Points: 85,
Visits: 394
|
|
I agree, they will have view only access to any production objects.
It has been difficult finding the right balance to allow development and debugging without giving too much permission. Thank you for responding!
kay
|
|
|
|
|
Keeper of the Duck
Group: Moderators
Last Login: Today @ 1:55 PM
Points: 6,584,
Visits: 1,789
|
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Yesterday @ 7:52 AM
Points: 3,280,
Visits: 6,622
|
|
Brian, I like this way better than my idea..
-Roy
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Wednesday, March 27, 2013 10:30 AM
Points: 33,
Visits: 490
|
|
Easy way to give users/developers view permission to Stored Procedures in SQL 2005:
USE AdventureWorks GO CREATE PROCEDURE usp_ExecGrantViewDefinition (@login VARCHAR(30)) AS /* Included Object Types are: P - Stored Procedure V - View FN - SQL scalar-function TR - Trigger IF - SQL inlined table-valued function TF - SQL table-valued function U - Table (user-defined) */ SET NOCOUNT ON
CREATE TABLE #runSQL (runSQL VARCHAR(2000) NOT NULL)
--Declare @execSQL varchar(2000), @login varchar(30), @space char (1), @TO char (2) DECLARE @execSQL VARCHAR(2000), @space CHAR (1), @TO CHAR (2)
SET @to = 'TO' SET @execSQL = 'Grant View Definition ON ' SET @login = REPLACE(REPLACE (@login, '[', ''), ']', '') SET @login = '[' + @login + ']' SET @space = ' '
INSERT INTO #runSQL SELECT @execSQL + schema_name(schema_id) + '.' + [name] + @space + @TO + @space + @login FROM sys.all_objects s WHERE type IN ('P', 'V', 'FN', 'TR', 'IF', 'TF', 'U') AND is_ms_shipped = 0 ORDER BY s.type, s.name
SET @execSQL = ''
Execute_SQL:
SET ROWCOUNT 1
SELECT @execSQL = runSQL FROM #runSQL
PRINT @execSQL --Comment out if you don't want to see the output
EXEC (@execSQL)
DELETE FROM #runSQL WHERE runSQL = @execSQL
IF EXISTS (SELECT * FROM #runSQL) GOTO Execute_SQL
SET ROWCOUNT 0
DROP TABLE #runSQL
GO
Once this procedure has been created you can grant the permissions as follows.
This example grants view definition to a user "XYZ" in "Adventureworks" Database for all object types that were selected.
USE Adventureworks GO EXEC usp_ExecGrantViewDefinition 'XYZ' GO
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, July 19, 2011 1:26 AM
Points: 9,
Visits: 16
|
|
In SQL Server 2005 you can define the execution context of the following user-defined modules: functions (except inline table-valued functions), procedures, queues
_________________ Download Microsoft 2010
|
|
|
|