|
-
December 29th, 2006, 04:12 AM
#1
Query For a table using column name
How to find the tables that uses the specific column name in the database (oracle 9i)?
Last edited by SVL; December 29th, 2006 at 05:46 AM.
-
December 29th, 2006, 04:39 AM
#2
Re: Query For a table using column name
Welcome to the Forum 
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
PHP Code:
Select
TABLES.[NAME] As TableName
From
SYSOBJECTS TABLES
Inner Join SYSCOLUMNS FIELDS
On TABLES.ID = FIELDS.ID
Where
FIELDS.[NAME] = 'MYFIELDNAME'
-
January 2nd, 2007, 06:38 AM
#3
Re: Query For a table using column name
Hi all (and happy new year)
It's quite simple; run the query
Code:
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|