December 19, 2012 at 12:20 pm
Anyone have any script for the following:
--GRANT EXEC permissions to all SPs and scalar functions to a DB role in a Database
--GRANT SELECT permissions to table-valued and inline functions to a DB role in a Database
Thanks,
SueTons.
Regards,
SQLisAwe5oMe.
December 19, 2012 at 12:47 pm
something like this?
note you have to modify the role everytime a proc/function is dropped and created, or new ones added.
CREATE ROLE MyExecProcRole;
CREATE ROLE MyExecFuncRole;
--GRANT EXEC permissions to all SPs and scalar functions to a DB role in a Database
SELECT
'GRANT EXEC ON '
+ schema_name(schema_id)
+ '.'
+ name
+ 'TO MyExecProcRole'
FROM sys.objects
where type_desc IN('SQL_STORED_PROCEDURE')
--GRANT SELECT permissions to table-valued and inline functions to a DB role in a Database
SELECT
'GRANT SELECT ON '
+ schema_name(schema_id)
+ '.'
+ name
+ 'TO MyExecFuncRole'
FROM sys.objects where type_desc IN('SQL_INLINE_TABLE_VALUED_FUNCTION',
'SQL_SCALAR_FUNCTION',
'SQL_TABLE_VALUED_FUNCTION')
Lowell
December 19, 2012 at 12:50 pm
Thanks Lowell, appreciate for your quick response.
SueTons.
Regards,
SQLisAwe5oMe.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply