Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Trouble granting EXECUTE on all procedures

$
0
0
I've found several code examples which describe how to make this work, and they all have very simple instructions.This is some code executed under my sysadmin account[code]set nocount onuse trx_dgoselect specific_name from information_schema.routines where routine_type = 'PROCEDURE' and specific_name = 'proc_plan_get_count';goexec dbo.proc_plan_get_count 225, 2016;gospecific_name----------------------------------proc_plan_get_countstatus_code status_count-------------------- ------------Approved 1[/code]Then I try & grant EXECUTE on all procedures in that database to a role, then grant that role to a user[code]USE trx_dGOCREATE ROLE db_executorGRANT EXECUTE TO db_executorALTER ROLE db_executor ADD MEMBER [smithr]GO[/code]Then I log in as smithr, and I'm able to see the procedure in the information_schema table, but I cannot execute it[code]set nocount onuse trx_dgoselect specific_name from information_schema.routines where routine_type = 'PROCEDURE' and specific_name = 'proc_plan_get_count';goexec dbo.proc_plan_get_count 225, 2016;goMsg 15151, Level 16, State 1, Procedure proc_plan_get_count, Line 25Cannot find the object 'proc_plan_get_count', because it does not exist or you do not have [/code]And here's something to add to the confusion ... when I switched the SSMS output to "Results to Text" so that I could copy/paste it into this posting, I started getting the following[code]specific_name----------------------------------proc_plan_get_countstatus_code status_count-------------------- ------------Approved 1Msg 15151, Level 16, State 1, Procedure proc_plan_get_count, Line 25Cannot find the object 'proc_plan_get_count', because it does not exist or you do not have permission.[/code]So, what originally looked like an inability to execute, turned into an ability to execute, with the subsequent error indicating that the object could not be found. I also tried changing the parameter values for the procedure to make sure that I was getting novel values for each execution, and I am.--=Chuck

Viewing all articles
Browse latest Browse all 3145

Trending Articles