Share via


ListPermissions Method

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

The ListPermissions method returns a SQLObjectList object that enumerates object access privilege for Microsoft SQL Server database roles and users.

Syntax

object
.ListPermissions( [ Privilege ] )as SQLObjectList

Parts

  • object
    Expression that evaluates to an object in the Applies To list.

  • Privilege
    Optional. Constrains the list to members that enumerates object access permissions as described in Settings.

Prototype (C/C++)

HRESULT ListPermissions(
LPSQLDMOPERMISSIONLIST* ppList,
SQLDMO_PRIVILEGE_TYPE lPrivilegeTypes);

Settings

When setting the Privilege argument to override default behavior, indicate more than a single permission by combining values using an OR logical operator. Set Privilege by using these SQLDMO_PRIVILEGE_TYPE values.

Constant

Value

Description

SQLDMOPriv_AllObjectPrivs

63

Default for DBObject, Table, and View objects. All applicable object privilege.

SQLDMOPriv_Delete

8

List object enumerates accounts granted permission to execute a DELETE statement against the referenced table or view.

SQLDMOPriv_Execute

16

Default for the StoredProcedure object. List object enumerates accounts granted EXECUTE permission on the referenced stored procedure.

SQLDMOPriv_Insert

2

List object enumerates accounts granted permission to execute an INSERT statement against the referenced table or view.

SQLDMOPriv_References

32

List object enumerates accounts that can use the referenced table in declarative referential integrity constraints.

SQLDMOPriv_Select

1

List object enumerates accounts granted permission to execute a SELECT statement against the referenced table or view.

SQLDMOPriv_Update

4

List object enumerates accounts granted permission to execute an UPDATE statement against the referenced table or view.

Returns

A SQLObjectList object that contains 0 or more Permission objects.

Remarks

The ListPermissions method enumerates object access permissions granted explicitly. When using ListPermissions with the Table object the default value of the Privilege parameter is SQLDMOPriv_Execute. For all other objects, the default value of the Privilege parameter is SQLDMOPriv_AllObjectPrivs.

SQL Server server and database roles assign privilege by granting statement execution permissions implicitly. Implicit grants are not enumerated by the ListPermissions method.