List views in Teradata with their scripts

Query below finds all views in all databases with their script.


SELECT  DatabaseName,
        TableName AS ViewName,
        RequestText AS Definition
FROM    DBC.TablesV
WHERE   TableKind = 'V'
AND     DatabaseName NOT IN ('All', 'Crashdumps', 'DBC', 'dbcmngr', 
'Default', 'External_AP', 'EXTUSER', 'LockLogShredder', 'PUBLIC', 'SQLJ', 
'Sys_Calendar', 'SysAdmin', 'SYSBAR', 'SYSJDBC', 'SYSLIB', 'SYSSPATIAL', 
'TD_SYSGPL', 'TD_SYSXML', 'TDMaps', 'TDPUSER', 'TDQCD', 'TDStats', 'tdwm')
ORDER BY    DatabaseName,


  • DatabaseName - database name
  • ViewName - view name
  • Definition - definition (script) of the view


  • One row represents a view
  • Scope of rows: all found views
  • Ordered by database & view name


Query excludes system databases, but this list may not be complete as it depends on the Teradata Database configuration.

Sample results

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
There are no comments. Click here to write the first comment.