查找具有执行权限的存储过程 [英] Finding stored procedures having execute permission

查看:25
本文介绍了查找具有执行权限的存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 SQL Server 2008 R2.我需要列出数据库用户 (MYUSER) 具有执行权限的所有存储过程.

I am using SQL Server 2008 R2. I need to list out all the stored procedures that a database user (MYUSER) has execute permission.

另外,我需要列出用户没有 EXECUTE 权限但可以读取存储过程脚本的存储过程

Also, I need to list out which are the stored procedures that the user does NOT have EXECUTE permission - but can read the script of the stored procedure

是否有任何用于这些目的的 SQL 语句或辅助函数?

Is there any SQL statement or helper function for these purpose?

参考:

  1. 授予对所有存储过程的执行权限在某个数据库中

推荐答案

使用 HAS_PERMS_BY_NAME:

select name, 
    has_perms_by_name(name, 'OBJECT', 'EXECUTE') as has_execute,
    has_perms_by_name(name, 'OBJECT', 'VIEW DEFINITION') as has_view_definition
from sys.procedures

这篇关于查找具有执行权限的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆