Revoke Method (StoredProcedure) (SQL-DMO)

The Revoke method undoes a grant or deny of a stored procedure permission for one or more Microsoft® SQL Server™ users or roles.

Applies To

StoredProcedure Object

Syntax

object.Revoke( Privilege , GranteeNames , [ GrantGrant ] ,
[ RevokeGrantOption ] , [ AsRole ] )

Part Description
object Expression that evaluates to an object in the Applies To list.
Privilege Long integer specifying one or more stored procedure permissions as described in Settings.
GranteeNames SQL-DMO multistring listing users or roles.
GrantGrant When True, the grantee(s) specified are granted the ability to execute the REVOKE statement referencing the stored procedure. When False (default), the ability to limit permission is not granted.
RevokeGrantOption When True, the ability to extend permission is revoked. When False (default), no change is made to the ability to extend permission.
AsRole String identifying a role to which the connected user belongs as described in Remarks.

Settings
Constant Value Description
SQLDMOPriv_AllObjectPrivs 63 Revoke all granted or denied privileges on the referenced stored procedure.
SQLDMOPriv_Execute 16 Revoke granted or denied execute permission on the referenced stored procedure.

Remarks

When a user is a member of more than a single role, the user can have permission to grant access to a stored procedure under one role and not under another. In this case, SQL Server security mechanisms prevent execution of the Revoke method on the StoredProcedure object referencing that stored procedure. Use the AsRole argument to specify the role under which permission to execute the grant exists.

Granting permissions to database users and roles by using the Revoke method of the StoredProcedure object requires appropriate privilege. The SQL Server login used for SQLServer object connection must be granted the ability to execute GRANT referencing the stored procedure, the owner of the stored procedure, or a member of a role with greater privilege.

Prototype (C/C++)

HRESULT Revoke(
SQLDMO_PRIVILEGE_TYPE iPrivileges,
SQLDMO_LPCSTR GranteeNames,
BOOL GrantGrant = FALSE,
BOOL RevokeGrantOption = FALSE,
SQLDMO_LPCSTR AsRole = NULL);

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.