开发者

list stored procedures that can be called by each user

i need a query to list every stored procedure that can be executed by a specif开发者_StackOverflow中文版ic user and This for each user of my mssql server 2005.

output example:

sa:

sp_MSrepl_startup

sp_MScleanupmergepublisher

administrator:

xp_foo

sp_bar

Any help will be appreciated

phillipe


Easiest would be sp_helprotect but it's legacy

This is SQL Server 2005+, but the code here quite basic and would need expanded as needed:

SELECT
    SUSER_SNAME(u.sid), OBJECT_NAME(p.major_id)
FROM
    sys.database_permissions p
    JOIN
    sys.database_principals u ON p.grantee_principal_id = u.principal_id

If the DB user has rights on the code without a role, or nested roles, this can get ugly quickly...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜