Revokes permissions from users, roles, or groups.
revoke [grant option for] {all [privileges] | permission_list} on {table_name [(column_list)] | view_name [(column_list)] | stored_procedure_name | function_name | keyname} [with {pred_name | {all |no} predicates}] from {public | name_list | role_list} [cascade] [granted by grantor]
revoke select on [builtin] builtin from {name_list | role_list} [granted by grantor]
revoke {all [privileges] | privilege_list} from {public | name_list | role_list} [granted by grantor]
revoke set proxy from {public | name_list | role_list} [granted by grantor]
revoke {dbcc_privilege [on database] [, dbcc_privilege [on database], ...]} from {user_list | role_list} [granted by grantor]
revoke default permissions on system tables
When granular permissions is not enabled, a system administrator or the database owner can use revoke all to revoke privileges to create database objects (see syntax for “Revokes system privileges”). When used by a system administrator, revoke all revokes all create privileges (create database, create default, create procedure, create rule, create table, create function, and create view). When the database owner uses revoke all, or executes revoke all outside the master database, the SAP ASE server revokes all create privileges except create database and prints an informational message.
Revoking all create privileges using revoke all is not supported when granular permissions is enabled. For more information, see Using Granular Permissions in the Security Administration Guide.
all cannot be used for a revoke statement that includes a where clause.
Object |
permission_list can include |
---|---|
Table |
select, insert, delete, update references, update statistics, delete statistics, truncate table, decrypt, identity_insert *, identity_update * |
View |
select, insert, delete, update, decrypt, identity_insert *, identity_update * |
Column |
select, update, references, decrypt Column names can be specified in either permission_list or column_list. |
Stored procedure |
execute |
Encryption key |
select |
Function |
execute * |
pred_name – name of the predicated grant you are revoking. sp_helprotect displays the predicate names that identify row-filtering grants.
no predicates – instructs the SAP ASE server to remove only non-predicated grants for the given access from the named grantee.
all predicates - instructs the SAP ASE server to remove all the predicated grants for the given access from the named grantor. Any non-predicated grants remain.
If you omit the with clause, both predicated and non-predicated grants are revoked (the default behavior).
If there are multiple revoked actions in the same command, database must be unique.
revoke insert, delete on titles from mary, sales
revoke select on builtin get_appcontext from public
revoke select on get_appcontext from public
revoke update on titles (price, advance) from public
revoke update (price, advance) on titles from public
revoke create database, create table from mary, john
revoke set proxy from harry, billy
revoke set session authorization from sso_role
revoke all from mary
revoke all on titles from mary
revoke references on titles (price, advance) from tom
revoke references (price, advance) on titles from tom
revoke execute on new_sproc from oper_role
revoke grant option for insert, update, delete on authors from john cascade
revoke dbcc checkdb on all from frank
revoke truncate table on authors from harry revoke update statistics on authors from harry
Users Billy and Harry can no longer run these commands on authors.
revoke truncate table on authors from oper_role revoke update statistics on authors from oper_role revoke delete statistics on authors from oper_role
revoke decrypt on customer from public
revoke create encryption key from joe
revoke select on ssn_key from dbo
grant select on t1 (col1, col4) to user1
grant select on t1 (col2, col3) where col1 = 1 as pred1 to user1
revoke select on t1 (col2) with pred1 from user1
revoke select on t1 (col2, col3) with pred1 from user1or
revoke select on t1 with pred1
revoke select on t1 with all predicates from user1
revoke select on t1 from user1
revoke select on t1 with no predicates
revoke select on mary.books from john granted by mary
use master
revoke manage any login from smith
See the grant command for more information about permissions.
You can revoke permissions only on objects in your current database.
You can revoke only permissions or privileges that were granted by you without using the granted by grantor option. With the granted by grantor option, you can revoke permissions or privileges granted by other users.
grant and revoke commands are order-sensitive. When there is a conflict, the command issued most recently takes effect. An exeption are grants and revokes of predicated privileges. See How SAP ASE Saves Predicated Privileges in sysprotects in the Security Administration Guide.
You can substitute the word to for the word from in the revoke syntax.
If you do not specify grant option for in a revoke statement, with grant option permissions are revoked from the user along with the specified object access permissions. In addition, if the user has granted the specified permissions to any other users, all of those permissions are revoked. In other words, the revoke cascades.
A user, group, or role can be granted the same privilege or permission by different grantors. In this situation, there are multiple rows in sysprotects which represents multiple grants on the same privilege or permission. If one or more than one grants are revoked later, the user, group, or role may still have the privilege or permission if there is at least one grant remain unrevoked.
A grant statement adds one row to the sysprotects system table for each user, group, or role that receives the permission. If you subsequently revoke the permission from the user or group, the SAP ASE server removes the row from sysprotects. If you revoke the permission from only selected group members, but not from the entire group to which it was granted, the SAP ASE server retains the original row and adds a new row for the revoke.
Permission to issue create trigger is granted to users by default. When you revoke permission for a user to create triggers, a revoke row is added in the sysprotects table for that user. To grant permission to issue create trigger, you must issue two grant commands. The first command removes the revoke row from sysprotects; the second inserts a grant row. If you revoke permission to create triggers, the user cannot create triggers even on tables that the user owns. Revoking permission to create triggers from a user affects only the database where the revoke command was issued.
In a clustered environment, revoke fails if you attempt to revoke permissions from user-defined roles in a local temporary database.
Database user groups allow you to grant or revoke permissions to more than one user at a time. A user is always a member of the default group, “public” and can be a member of only one other group. The SAP ASE installation script assigns a set of permissions to “public.”
Create groups with sp_addgroup and remove groups with sp_dropgroup. Add new users to a group with sp_adduser. Change a user’s group membership with sp_changegroup. To display the members of a group, use sp_helpgroup.
proc_role in Reference Manual: Building Blocks
sp_activeroles, sp_adduser, sp_changedbowner, sp_changegroup, sp_displaylogin, sp_displayroles, sp_dropgroup, sp_dropuser, sp_helpgroup, sp_helprotect, sp_helpuser in Reference Manual: Procedures
ANSI SQL – Compliance level: Transact-SQL extension.
The permission checks for revoke differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, in general, revoke can be executed by a user with one of the following privilege management privileges, depending the privilege or permission being revoked. For server-wide privileges, you must be a user with manage server permissions privilege or manage security permissions privilege. For database-wide privileges, you must be a user with manage database permissions privilege. For object privileges, you must be the object owner or be a user with manage any object permission privilege. To execute revoke default, you must be the database owner or a user with own database privilege on the database. |
Disabled | With granular permissions enabled:
|
Values in event and extrainfo columns of sysaudits are:
Information | Values |
---|---|
Event | 47 |
Audit option | revoke |
Command or access audited | revoke |
Information in extrainfo |
|