Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search for tables that has a specific column 3

Status
Not open for further replies.

BenjaminLim

IS-IT--Management
May 24, 2000
73
GB
Hi,

I like to search for all tables that contains "Employee ID" column. What would be the synthax like?

Please advice.

Thanks.
 
This is DB specific, if you are on oracle then you could do...

select table_name
from dbam_tables
where column_name = 'EMPLOYEE_ID'
/
 
I can't find anything called dbam_tables, nor have I ever heard of this table.

For Oracle, I recommend

select table_name
from dba_tab_columns
where column_name = 'EMPLOYEE_ID';
 
Thanks Carp & MikeJones.

I tried the synthax you have provided but encounter "Object does not exist" message.

Kindly advice whether is this usually controlled by DBAs or ..

Thanks

Regards
Benjamin
 
Pardon my fingers, it should have read dba_tables, which as you point out is wrong anyway as it wouldn't contain any column info, however sidesteping my gross incompetence at typing if your getting that error then you proably don't have those views created (I don't know if they come as standard on an install). Carps suggestion should work though!

Assuming you are on an Oracle database then you could try...

SELECT table_name
FROM all_tab_columns
WHERE column_name = 'EMPLOYEE_ID'
/

If this won't work either then I'd ask what user you are logging in as and if they have DBA Privs on the DB?

HTH,

Mike.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top