Finding stored procedures having execute permission

后端 未结 5 1384
长发绾君心
长发绾君心 2021-01-02 02:31

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

Also, I need to list out which ar

5条回答
  •  -上瘾入骨i
    2021-01-02 02:59

    Extending on the accepted answer above, in order to check objects outside of the dbo schema, use the following statement.

      SELECT 
        name,
        HAS_PERMS_BY_NAME(QUOTENAME(SCHEMA_NAME(schema_id)) + '.' + QUOTENAME(name), 'OBJECT', 'EXECUTE') AS has_execute,
        HAS_PERMS_BY_NAME(QUOTENAME(SCHEMA_NAME(schema_id)) + '.' + QUOTENAME(name), 'OBJECT', 'VIEW DEFINITION') AS has_view_definition
      FROM sys.procedures
    

提交回复
热议问题