Assuming all of the stored procs contain the string 'MyApp' in the name, and all need execute permissions added for 'myuser', the following will make the necessary change
declare @SQL varchar(8000)
select @SQL = isnull(@SQL, '') +
'grant execute on [' +
routine_schema + '].[' +
routine_name + '] to [myuser];'
from information_schema.routines
where SPECIFIC_NAME like '%MyApp%'
exec (@SQL )
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.