var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Drop multiple tables - auto-generating script
Greetings to all.
I have some very specific issue. Target is to drop multiple tables in one schema that are older than 3 months and have certain prefix.
The difficulty is that I need to desing a script, that will generate drop statements automatically, so that I could shedule it to a crontab for daily execution.
Shortly, I need this two actions:
been packed in a script that will generate the list of tables to be dropped and then drop those tables.
db2 "Select 'DROP TABLE ', tabname, ';' from syscat.tables where owner='DBUSER'" >> filename
db2 -tvf filename>log
Actually, I have no idea how to do that... Please, give an advice.
db2 -x "select 'drop table '||trim(tabschema)||'.'||trim(tabname)||';' from syscat.tables where ..." -z drop_script.ddl
db2 -tvsf drop_script.ddl
Tags for this Thread