Was this helpful?
GRANT
Valid in: SQL, ESQL, OpenAPI, ODBC, JDBC, .NET
The GRANT statement grants privileges on the database as a whole or on individual tables, views, or procedures.
The GRANT (privilege) statement has the following format:
[EXEC SQL] GRANT ALL [PRIVILEGES] | privilege {, privilege}
              [ON [TABLE] [schema.]table_name
                           TO PUBLIC | auth_id {, auth_id}
              [WITH GRANT OPTION];
privilege
Specifies the type of privilege.
table_name
Specifies the name of the table for which the privilege is being defined.
PUBLIC
Grants the privilege to all users.
auth_id
Specifies the name of the users to which you are granting privileges.
The grant statement enables a DBA or user to control access to tables. To remove privileges, use the REVOKE statement. The following table describes the GRANT statement parameters.
By default, neither the public nor any user has any table privileges. Table privileges must be granted explicitly. Valid table privileges are:
Select
Insert
Update
For update, a list of columns can optionally be specified; if the column list is omitted, update privilege is granted to all updatable columns of the table or view.
Delete
References—The references privilege enables specified users to create referential constraints that reference the specified tables and columns. For details about referential constraints, see CREATE TABLE (extended).
A list of columns can optionally be specified. If the column list is omitted, references privilege is granted to all updatable columns of the table. You cannot grant the references privilege on a view.
All [privileges]—All grants select, insert, update, delete, and references on the specified objects to the specified users.
Last modified date: 11/09/2022