Query to Check the Last Time a Teradata View was Rebuilt or Altered

Recently I was asked to update a couple of views on a Teradata database.  This script was an easy way to verify that the Teradata views’ timestamp for the DDL was updated.

select
DatabaseName,
TableName, -- This will be the view name
Version,  -- The times this view has been rebuilt
TableKind, -- Should be V for view
CreateTimeStamp,  -- When the view first created
LastAlterTimeStamp  -- Last time view was rebuilt
from Dbc.Tables
where
DataBaseName = 'retail' -- isolates for my database only
and
TableKind = 'V'  -- forces only views to be displayed
and
tablename in (     -- list the views that I am updating
'vAREA' ,  
'vCLIENT' , 
'vEMPLOYEE', 
'vITEM', 
'vPRODUCT' 
)
order by 2

Teradata Check Query DDL

Leave a Comment