What is with grant option in db2?

What is with grant option in db2?

When WITH GRANT OPTION is used with PUBLIC, a warning is issued, and the named privileges are granted, but without GRANT authority. If you grant the CREATE_SECURE_OBJECT system privilege, the WITH GRANT OPTION clause is ignored because the CREATE_SECURE_OBJECT system privilege cannot be granted to others.

What is grant option in database?

The WITH GRANT OPTION keywords convey the privilege or role to a user with the right to grant the same privileges or role to other users. You create a chain of privileges that begins with you and extends to user as well as to whomever user subsequently conveys the right to grant privileges.

What is Grant statement in SQL?

SQL Grant command is specifically used to provide privileges to database objects for a user. This command also allows users to grant permissions to other users too. Syntax: grant privilege_name on object_name to {user_name | public | role_name}

How do I grant SELECT privileges to user for all tables in db2?

How to grant select privileges on all tables for DB2

  1. MYDB=””
  2. MYSCHEMA=””
  3. MYUSER=””
  4. db2 “CONNECT TO $MYDB”
  5. DBTABLES=`db2 -x “SELECT tabname FROM syscat.tables WHERE tabschema=UPPER(‘$MYSCHEMA’)”`
  8. done.

What is the difference between Grant and with Grant?

The difference between these options is very simple. In case of only GRANT, the username cannot grant the same permission to other users. On the other hand, with the option WITH GRANT, the username will be able to give the permission after receiving requests from other users.

Can we use grant command on view?

Note: To grant privileges to all tables (or views) contained within a database, simply grant the privilege to the database. If the ALL [PRIVILEGES] keywords are specified following GRANT, all table or view privileges (for which the issuer has GRANT authority) are granted for the objects identified in the ON clause.

What is GRANT statement?

GRANT statements grant privileges on database objects to users and roles.

What is GRANT command?

The grant command is used by users to provide privileges to database objects and to provide permission to other users. A privilege gives permission to access a named object. For example, permission to access a database table. Users who obtain privileges can gain a connection to the database.

How do I grant all tables in a schema?


  1. Get the list of schemas in your database. Run the SHOW SCHEMAS command to retrieve all schemas in your database; e.g., dbtest: SHOW SCHEMAS IN DATABASE dbtest;
  2. Grant privileges. Grant a specific privilege on all tables in all schemas in a database.

Recent Posts