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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search all tables

Status
Not open for further replies.

leburg

Programmer
Feb 15, 2006
64
US
Okay, I'm writing a crystal report, don't have a data structure. Not an SQL guru, but need one. What I'd like to do is search the entire database, all tables, for a word string in an effort to find a field in a specific table that is harboring the data I'm after.

Like search all tables in sqldb for field with 'opening balance'

Or something like that. Is it possible?

It's late I'm tired thanks much in advance.
 
Search all data stored, or just column names? Just column names isn't too bad, but thats probably something you want to figure out before you write your report. In oracle, you can select * from user_tab_columns where column_name = 'opening_balance'. There is probably a similar table for other enterprise level databases. Searching all data in a database is a very bad idea.
 
I'm afraid it's not possible to do this
"search the entire database, all tables, for a word string in an effort to find a field in a specific table that is harboring the data I'm after."
in SQL.


Each table needs to be queried seperately for the data you're looking for. To automate it, you would need a procedural extension like PL/SQL or T-SQL to loop through each column in each table looking for the string you're after. Or you could write some actual code (VB,C#, Java, etc) to do it for you.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top