• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

SQL Question - Querying the DB objects

Ruprect

Super poster
Thanks received
1
Did a quick google and came up with little so I thought I'd ask you lot seeing as you all love showing off your skills :wink

How can I find a table/view that contains a column that I know the name of?

e.g. I know the name of a column is "ISBN", how can I find, using a query, the table "Book"?

Know what I mean?

If possible, I would like to be able to do this across the whole DBMS, not just one database within it.

Over to you gurus :)
 
Give us a clue - what kind of database are you working with??????

Code:
SELECT table_name
FROM   dba_tab_columns
WHERE  column_name = 'ISBN'

will do it in Oracle for you.
 
Off the top of my head its the syscolumns and sysobjects tables you need to join and query. The command sp_tables will list the tables you can view including system OR if your using Rapid SQL just use the 'Search DB option' under 'Tools'.

Sybase is sh*t, current gig is Sybase 6 months and just got another 6 months but Im seriously considering looking else soley because 12 months Sybase in line of work and not Oracle will make getting a new contract very hard.
 
Last edited: 10:54

Advertisers

Back
Top