Teradata Query To Fetch TableName

Database
Enthusiast

Teradata Query To Fetch TableName

Hi,
I want to search for tables in a database which have a particular column in them(say the column is 'email_ids').Is there any teradata query , by firing which , we can get all the table names from the
database which have this particular column?
If yes, pls post the query.

Thanks!
1 REPLY
jpg
Enthusiast

Re: Teradata Query To Fetch TableName

try (not tested):

select distinct databasename, tablename

from dbc.columns

where columnname = 'your_column_here'

;

If you want only table references (i.e. not view refs)

select distinct a.databasename, a.tablename

from dbc.columns a

inner join

dbc.tables b

on b.databasename = a.databasename

and b.tablename = a.tablename

and b.tablekind = 'T'

where a.columnname = 'your_column_here'

;