Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Grant Permissions


Grant Permissions

Author
Message
HBK_4700
HBK_4700
Old Hand
Old Hand (364 reputation)Old Hand (364 reputation)Old Hand (364 reputation)Old Hand (364 reputation)Old Hand (364 reputation)Old Hand (364 reputation)Old Hand (364 reputation)Old Hand (364 reputation)

Group: General Forum Members
Points: 364 Visits: 1821
Hi, I need to grant exec permissions to some stored procedures(example start with ABC_SP%) to a db role.

I created below script and added in SSIS package executive task (Basically I added Sequence Container[exec sql task(results to variable)+ foreach loop container(execsql task)])
Package is executing successfully but when i check permissions are not granted to db role on those sp's. The same script i can run in Management studio and getting the required output. Please advise.

select
'GRANT EXECUTE ON [' + SPECIFIC_NAME + '] to [dbRole]' as GrantStmt
from information_schema.routines
where (ROUTINE_TYPE = 'PROCEDURE' OR (ROUTINE_TYPE = 'FUNCTION' and DATA_TYPE <> 'TABLE'))
AND (SPECIFIC_NAME like 'ABCsp_XYZ%' or SPECIFIC_NAME like 'ABCXYZ%%')
union all
select
'GRANT SELECT ON [' + SPECIFIC_NAME + '] to [dbRole]' as GrantStmt
from information_schema.routines
where ROUTINE_TYPE = 'FUNCTION'
AND DATA_TYPE = 'TABLE'
AND (SPECIFIC_NAME like 'ABCsp_XYZ%' or SPECIFIC_NAME like 'ABCspXYZ%')
union all
select
'GRANT SELECT,INSERT,UPDATE,DELETE ON [' + TABLE_NAME + '] to [dbRole]' as GrantStmt
from information_schema.TABLES
where TABLE_NAME like 'ABCsp_XYZ%' or TABLE_NAME like 'ABCXYZ%'
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search