If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
I have around 10,000 tables in my db2 database. I have to grant a user insert privilege to all the tables in the database. Please let me know the command to perform this grant operation in a single shot.
You cannot do that with one command, but you can build a script that will do that:
db2 connect to XXXXX
db2 "select 'grant insert on table '||rtrim(tabschema)||'.'||rtrim(tabname)||' to authorization-name;' from syscat.tables where tabschema <> 'SYSIBM' and type = 'T'"
Pipe the output to a file. Edit the file a bit and submit it to grant the inserts.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
you used rtrim(tabschema) for character string values. If I have to pass integer variable say "tbspaceid" in the below command I am facing the errors.
C:\>db2 "select 'list tablespace container for '||rtrim(tbspaceid)||' with detail' from syscat.table
spaces"
SQL0440N No authorized routine named "RTRIM" of type "FUNCTION" having
compatible arguments was found. SQLSTATE=42884