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 2012 Forums
 SQL Server Administration (2012)
 Grant Permissions on a list of Stored Procedures

Author  Topic 

jazzcatone
Starting Member

12 Posts

Posted - 2013-08-01 : 09:52:42
I have a list of existing stored proceudures that I can get by running the below query. I have a new sqluser called "XXXXXX" . How can I iterate through the result set in sql and give execute permissions to user XXXXXX. Any help or direction would be most appreciated.

Jason

SELECT [name]
FROM sys.objects obj
WHERE obj.[type] = 'P' and name like'JL_%'


Jason

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-08-01 : 10:45:04
Modify the query to generate the grant statements, run it, copy the results to an SSMS query window and execute it
SELECT 'GRANT EXECUTE ON ' + [name] + ' TO XXXXXX'
FROM sys.objects obj
WHERE obj.[type] = 'P' and name like'JL_%'
Go to Top of Page
   

- Advertisement -