Hi @pmscorca
Hi, the stored procedures are almost 800. I need to grant the execution permission to the all SPs.
Try this code:
DECLARE @sql VARCHAR(MAX) = '';
SELECT @sql += 'GRANT EXECUTE ON [' + s.name + '].[' + p.name + '] TO [UserName];' + CHAR(13)
FROM sys.procedures p JOIN sys.schemas s ON p.schema_id = s.schema_id;
PRINT @sql -- Check the generated GRANT statements
EXEC sp_executesql @sql;
Best regards,
Cosmog
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".