943,526 Members | Top Members by Rank

Ad:
Oct 30th, 2007
0

Complex Database Searching...........

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
nice_true is offline Offline
28 posts
since Sep 2007
Aug 6th, 2009
0

Re: Complex Database Searching...........

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.
sql Syntax (Toggle Plain Text)
  1. SELECT * FROM <table1> WHERE <field1> LIKE '%value%'
The best bet is to have the statements automatically generated, having the <tables> and <fields> as variables.
Last edited by peter_budo; Aug 6th, 2009 at 7:46 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 33
Solved Threads: 4
Newbie Poster
ferensick is offline Offline
20 posts
since Feb 2008
Aug 7th, 2009
0

Re: Complex Database Searching...........

try this.
Attached Files
File Type: zip SEARCH.zip (38.4 KB, 15 views)
Reputation Points: 14
Solved Threads: 78
Practically a Posting Shark
abu taher is offline Offline
835 posts
since Jul 2008
Aug 11th, 2009
0

Re: Complex Database Searching...........

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.
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007
Sep 11th, 2009
0

Re: Complex Database Searching...........

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.
Reputation Points: 53
Solved Threads: 20
Junior Poster in Training
padtes is offline Offline
82 posts
since Aug 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Database Design Forum Timeline: Question about how to design a parts location database
Next Thread in Database Design Forum Timeline: advice on a database design please





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC