Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Purge the work tables cretaed a month before and create report with the list of work tables created last month - response (2) by ulrich

$
0
0
try  SELECT DISTINCT 'DROP TABLE DB1.' || TABLENAME || ' ; ' !! case when row_number() over (order by tablename) mod 10 = 0 then '.hang 50;' else '' end FROM dbc.tables WHERE tablekind = 'T' AND databasename = 'DB1' AND TRIM(tablename) LIKE any ('WK_%0','WK_%1','WK_%2','WK_%3','WK_%4','WK_%5','WK_% 6','WK_%7','WK_%8','WK_%9') AND CAST(CreateTimeStamp AS DATE) < add_months(date - extract(day from date) + 1, -1) ;

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>