Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

View validity check - response (1) by ulrich

$
0
0

its not possible to get this info out of dbc
it can change any time and maybe in 5 min the view is valid again.
try the following bteq script

.logon system/user,passwd;

.set width 500;
create volatile table invalid_views (databasename varchar(30), tablename varchar(30)) unique primary index (databasename, tablename) on commit preserve rows;

.OS rm /yourpath/out.bteq

.export data file=/yourpath/out.bteq
.RECORDMODE OFF
.FOLDLINE ALL

select 'show select * from ' || trim(databasename) || '.' || trim(tablename) || ';',
'.if errorcode = 0 then .goto next;',
'insert into invalid_views values ('''||trim(databasename)||''',''' ||trim(tablename)||''');',
'.label next;'
from dbc.tables 
where tablekind = 'V'
order by 1;

.export reset

.run file = /yourpath/out.bteq

.FOLDLINE OFF ALL

select * 
from invalid_views
order by 1,2
;

 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



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