Click to See Complete Forum and Search --> : Query For a table using column name


SVL
December 29th, 2006, 03:12 AM
How to find the tables that uses the specific column name in the database (oracle 9i)?

Shuja Ali
December 29th, 2006, 03:39 AM
Welcome to the Forum :wave:

Without knowing the Database that you are using, it is almost impossible to give a solution or suggest something. You need to tell us which database you are using.

For SQL 2000, you can use Select
TABLES.[NAME] As TableName
From
SYSOBJECTS TABLES
Inner Join SYSCOLUMNS FIELDS
On TABLES.ID = FIELDS.ID
Where
FIELDS.[NAME] = 'MYFIELDNAME'

davide++
January 2nd, 2007, 05:38 AM
Hi all (and happy new year)

It's quite simple; run the query


SELECT TABLE_NAME
FROM USER_TAB_COLUMNS
WHERE COLUMN_NAME = 'MY_COLUMN'


It extracts all tables of the schema which have the column 'MY_COLUMN'
If you use DBA_TAB_COLUMNS instead of USER_TAB_COLUMNS, you'll find all table in any schema of the instance which have a specified column.