How to find tables that have a specific column name?

Using the following SQL one can find tables that contain a column name.

In SQLServer
SELECT table_name, column_name
FROM INFORMATION_SCHEMA.COLUMNS
WHERE column_name like ‘%PASSWORD%’
ORDER BY table_name;

In Oracle
SELECT owner, table_name, column_name
FROM dba_tab_columns
WHERE column_name like 'PASSWORD'
ORDER by table_name;

Example:
OWNER TABLE_NAME COLUMN_NAME
—————————— —————————— ——————————
SYS DBA_USERS PASSWORD

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.