Using Teradata SQL: How to find all the tables in a database or user area

Sometimes it can be useful to find all the tables in a particular database or your user area (your personal database) in Teradata. This SQL will do that for you -

SELECT * FROM  dbc.tables WHERE databasename = (SELECT USER) AND TABLEKIND = 'T';

To find tables that match a naming pattern or convention you can use -

 SELECT * FROM  dbc.tables WHERE databasename LIKE 'Customer%' AND TABLEKIND = 'T';

"Real difficulties can be overcome, it is only the imaginary ones that are unconquerable." - Theodore N. Vail



Jamie Whitehorn

Jamie Whitehorn

A self proclaimed geek who loves technology, data, computers and science; but balances this by spending time with his wonderful better half and their dogs and horses in the countryside.

comments powered by Disqus