|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Yesterday @ 9:41 PM
Points: 1,604,
Visits: 2,782
|
|
Is there a way to grant a user to alter, view and execute all the stored procedure in a database?
I have set him as a db_writer, but I don't think that includes above access?
Thanks
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 12:04 AM
Points: 26,
Visits: 80
|
|
You can use the code as follow which use cursor to grant permission.
declare @sp_name nvarchar(300) declare @sql nvarchar(300) declare cursor_name cursor for select quotename(b.name)+'.'+ quotename(a.name) from sys.objects a inner join sys.schemas b on a.schema_id=b.schema_id where type='p' open cursor_name fetch next from cursor_name into @sp_name while @@fetch_status=0 begin print @sp_name set @sql=N'GRANT ALTER,execute,view definition ON '+@sp_name+' TO ***user***' exec sp_executesql @sql
fetch next from cursor_name into @sp_name end close cursor_name deallocate cursor_name
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 8:50 AM
Points: 2,037,
Visits: 3,759
|
|
Perhaps this may be simpler:
use [YourDB] GO GRANT ALTER, EXECUTE, VIEW DEFINITION TO [DOMAIN\User] GO
______________________________________________________________________________ "Never argue with an idiot; They'll drag you down to their level and beat you with experience"
|
|
|
|