MS SQL Server:检查用户是否可以执行存储过程 [英] MS SQL Server: Check to see if a user can execute a stored procedure

查看:34
本文介绍了MS SQL Server:检查用户是否可以执行存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查用户是否可以在 MS SQL 服务器中执行存储过程?

How can you check to see if a user can execute a stored procedure in MS SQL server?

我可以通过连接到master数据库并执行来查看用户是否具有显式执行权限:

I can see if the user has explicit execute permissions by connecting to the master database and executing:

databasename..sp_helpprotect 'storedProcedureName', 'username'

但是,如果用户是具有执行权限的角色的成员,sp_helprotect 将无济于事.

however if the user is a member of a role that has execute permissions sp_helprotect won't help me.

理想情况下,我希望能够调用类似

Ideally I'd like to be able to call something like

databasename..sp_canexecute 'storedProcedureName', 'username'

这将返回一个布尔值.

推荐答案

<代码>fn_my_permissionsHAS_PERMS_BY_NAME

这篇关于MS SQL Server:检查用户是否可以执行存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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