Revoke Method (Database)

后续版本的 Microsoft SQL Server 将删除该功能。请避免在新的开发工作中使用该功能,并着手修改当前还在使用该功能的应用程序。

The Revoke method undoes a grant or deny of database permissions for one or more Microsoft SQL Server users or roles.

语法

object
.Revoke(
Privilege
,
GranteeNames
)

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • Privilege
    Long integer that specifies one or more database permissions as described in Settings.
  • GranteeNames
    SQL Distributed Management Objects (SQL-DMO) multi-string that lists users or roles.

Prototype (C/C++)

HRESULT Revoke(
SQLDMO_PRIVILEGE_TYPE iPrivileges,
SQLDMO_LPCSTR GranteeNames);

Settings

Set Privilege by using these SQLDMO_PRIVILEGE_TYPE values. To specify more than a single permission, combine values by using an OR logical operator.

Constant Value Description

SQLDMOPriv_/AllDatabasePrivs

130944

Revoke all granted or denied database permissions.

SQLDMOPriv_CreateDatabase

256

Revoke granted or denied permission to execute a CREATE DATABASE statement.

SQLDMOPriv_CreateDefault

4096

Revoke granted or denied permission to execute a CREATE DEFAULT statement.

SQLDMOPriv_CreateFunction

65366

Revoke granted or denied permission to execute a CREATE FUNCTION statement.

SQLDMOPriv_CreateProcedure

1024

Revoke granted or denied permission to execute a CREATE PROCEDURE statement.

SQLDMOPriv_CreateRule

16384

Revoke granted or denied permission to execute a CREATE RULE statement.

SQLDMOPriv_CreateTable

128

Revoke granted or denied permission to execute a CREATE TABLE statement.

SQLDMOPriv_CreateView

512

Revoke granted or denied permission to execute a CREATE VIEW statement.

SQLDMOPriv_DumpDatabase

2048

Revoke granted or denied permission to back up the database.

SQLDMOPriv_DumpTable

32768

Maintained for compatibility with previous versions of SQL-DMO.

SQLDMOPriv_/DumpTransaction

8192

Revoke granted or denied permission to back up the database transaction log.

备注

Revoking granted or denied permissions to database users and roles by using the Revoke method of the Database object requires appropriate permission. The Microsoft SQL Server login used for SQLServer object connection must be a member of the system-defined role sysadmin.

For more information about setting multistring parameters, see Using SQL-DMO Multistrings.

Applies To:

Database Object