Here are a few more nice DB2 scripts that would save you time:
Get all tables in Table Space
-- Get all tables in particular tablespaceselect SUBSTR(TABNAME,1,25) "TABNAME", SUBSTR(TABSCHEMA,1,15) "SCHEMA", NPAGES, CARD from syscat.tables where tbspace = '?'
Generate Grants for all tables in Table Space
-- Genereating GRANTS SELECT 'grant select on ' || tabname || ' to PSFDEV' || ';' FROM syscat.tables WHERE tabname NOT IN (SELECT tabname FROM syscat.tabauth WHERE grantee = 'PSFDEV') AND tabschema = 'PSFSSYS' AND (type = 'T' OR type = 'V')
Tags: DB2 · SQL · TipsNo Comments

0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.