Thursday 13 October 2016

Grant Select privilege on all tables in schema to user in DB2

Query:

1) Generate grant statement to grant select privilege to user on all tables in schema
select 'grant insert, update, delete on table ' || trim(tabschema) || '.' || 
trim(tabname) || ' to user test;' from syscat.tables where type = 'T'
The above query generate grant statements
2) Run the Grant Statement to grant select and update access for all tables to user in schema
 
grant select,update on "tabschema"."tabname" to user "username"

where "tabschema" = Schema name of DB2 Instance
            "tabname"= name of table

Replace original values in the double quotes

No comments:

Post a Comment