REVOKE statement

Description

Removes permissions for specified users.

Syntax

Syntax 1

REVOKECONNECT | DBA | INTEGRATED LOGIN | GROUPKERBEROS LOGIN | MEMBERSHIP IN GROUP userid [, …] | RESOURCE }
… FROM userid [, …]

Syntax 2

REVOKE
{…ALLPRIVILEGES ] | ALTER | DELETE | INSERT
| REFERENCE | SELECT [ ( column-name [, …] ) ] | UPDATE [ ( column-name, …) ] }
… ONowner.]table-name FROM userid [, …]

Syntax 3

REVOKE EXECUTE ONowner.]procedure-name FROM userid [, …]

Syntax 4

REVOKE CREATE ON dbspace-name FROM userid [, …]

Examples

Example 1

Prevents user “dave” from inserting into the Employees table:

REVOKE INSERT ON Employees FROM dave ;

Example 2

Revokes resource permission from user “Jim”:

REVOKE RESOURCE FROM Jim ;

Example 3

Prevents user “dave” from updating the Employees table:

REVOKE UPDATE ON Employees FROM dave ;

Example 4

Revokes integrated login mapping from the user profile name “Administrator”:

REVOKE INTEGRATED LOGIN FROM Administrator ;

Example 5

Disallows the finance group from executing the procedure sp_customer_list:

REVOKE EXECUTE ON sp_customer_list
FROM finance ;

Example 6

Drops user ID franw from the database:

REVOKE CONNECT FROM franw ;

Example 7

Revokes CREATE privilege on dbspace DspHist from user Latifah:

REVOKE CREATE ON DspHist FROM Latifah

Example 8

Revokes CREATE permission on dbspace DspHist from user ID fionat from the database:

REVOKE CREATE ON DspHist FROM fionat ;

Usage

The REVOKE statement is used to remove permissions that were given using the GRANT statement. Syntax 1 is used to revoke special user permissions and Syntax 2 is used to revoke table permissions. Syntax 3 is used to revoke permission to execute a procedure. REVOKE CONNECT is used to remove a user ID from a database.

NoteIf Login Management is enabled for the database, you must use system procedures, not GRANT and REVOKE, to add and remove user IDs.

REVOKE GROUP automatically revokes membership from all members of the group.

REVOKE CREATE removes Create permission on the specified dbspace from the specified user IDs.

You cannot revoke permissions for a specific user within a group. If you do not want a specific user to access a particular table, view, or procedure, then do not make that user a member of a group that has permissions on that object.

NoteYou cannot revoke the connect privileges of a user if that user owns database objects, such as tables. Attempting to do so with a REVOKE statement or sp_dropuser procedure returns an error such as “Cannot drop a user that owns tables in runtime system.”


Side effects

Automatic commit.

Standards

Permissions

Must be the grantor of the permissions that are being revoked, or must have DBA authority.

If revoking CONNECT permissions or revoking table permissions from another user, the other user must not be connected to the database.

For Syntax 4, you must have DBA authority.

See also

GRANT statement