Compartir a través de


ListDatabasePermissions Method

Esta característica se quitará en una versión futura de Microsoft SQL Server. Evite utilizar esta característica en nuevos trabajos de desarrollo y tenga previsto modificar las aplicaciones que actualmente la utilizan.

The ListDatabasePermissions method returns a SQLObjectList object that enumerates database maintenance privilege for one or more Microsoft SQL Server security accounts.

Sintaxis

object
.ListDatabasePermissions( [ Privilege ] )asSQLObjectList

Parts

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

  • Privilege
    Optional. Constrains the list to members that enumerates database maintenance statement permissions as described in Settings.

Prototype (C/C++)

HRESULT ListDatabasePermissions(
LPSQLDMOPERMISSIONLIST* ppList,
SQLDMO_PRIVILEGE_TYPE lPrivilegeTypes = SQLDMOPriv_AllDatabasePrivs);

Settings

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

Constant

Value

Description

SQLDMOPriv_AllDatabasePrivs

130944

Default. List object enumerates all database maintenance statement execution permissions.

SQLDMOPriv_CreateDatabase

256

List object enumerates accounts granted permission to execute the CREATE DATABASE statement.

SQLDMOPriv_CreateDefault

4096

List object enumerates accounts granted permission to execute the CREATE DEFAULT statement.

SQLDMOPriv_CreateFunction

65366

List object enumerates accounts granted permission to execute the CREATE FUNCTION statement.

SQLDMOPriv_CreateProcedure

1024

List object enumerates accounts granted permission to execute the CREATE PROCEDURE statement.

SQLDMOPriv_CreateRule

16384

List object enumerates accounts granted permission to execute the CREATE RULE statement.

SQLDMOPriv_CreateTable

128

List object enumerates accounts granted permission to execute the CREATE TABLE statement.

SQLDMOPriv_CreateView

512

List object enumerates accounts granted permission to execute the CREATE VIEW statement.

SQLDMOPriv_DumpDatabase

2048

List object enumerates accounts with privilege required to backup a database.

SQLDMOPriv_DumpTransaction

8192

List object enumerates accounts with privilege required to backup a database transaction log.

Returns

A SQLObjectList object that contains 0 or more Permission objects.

Comentarios

The ListDatabasePermissions method enumerates statement execution permission explicitly granted, and is maintained for compatibility with previous versions of SQL Server.

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

For example, a user may be a member of the db_backupoperator role. The user has permission to execute a Transact-SQL BACKUP statement targeting either the database or its transaction log. The user will not be enumerated by the ListDatabasePermissions method as the grant is implicit in the role.