Execute the following code, it will give your the output as the statements. Copy those statements and execute it. All the procedures and Table will get Grant Permission in few minutes
Code to Get the Script for Procedure.
SELECT
' Grant Execute on '+s.name+'.'+pr.name +' to UserGroup1
FROM
sys.procedures pr
INNER JOIN
sys.schemas s ON pr.schema_id = s.schema_id;
Code to Get the Script for Tables
SELECT
'Grant Select,Insert,update,Alter,References,Delete on '+s.name+'.'+t.name+' to UserGroup1'
FROM sys.tables AS t
INNER JOIN sys.schemas AS s
ON t.[schema_id] = s.[schema_id]
WHERE t.name like 'p_%'
Et Voila
Pushparaj
Code to Get the Script for Procedure.
SELECT
' Grant Execute on '+s.name+'.'+pr.name +' to UserGroup1
FROM
sys.procedures pr
INNER JOIN
sys.schemas s ON pr.schema_id = s.schema_id;
Code to Get the Script for Tables
SELECT
'Grant Select,Insert,update,Alter,References,Delete on '+s.name+'.'+t.name+' to UserGroup1'
FROM sys.tables AS t
INNER JOIN sys.schemas AS s
ON t.[schema_id] = s.[schema_id]
WHERE t.name like 'p_%'
Et Voila
Pushparaj
No comments:
Post a Comment