Hi!

How can I seach all of the fields of every table in a databae for a
particular value? When it is found, I want to be able to display the table
name and the field name, then continue to search.

Recommended Answers

All 4 Replies

Not enough info is given here... such as, db used, is this front-end, back-end, etc?
One way to do this is to simply use a SELECT statement.

SELECT * FROM <table1> WHERE <field1> LIKE '%value%'

The best bet is to have the statements automatically generated, having the <tables> and <fields> as variables.

try this.

If the database is oracle you need to play with USER_TAB_COLS view. You need to frame queries dynamically at run time in a loop and execute.

In dot net, once you connect to a database, you have lists of all tables and for each table, list of columns available. Select * from each of the table and loop through all columns for all records.

Sounds like simple looping but might be whole lot of work for the machine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.