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

Database search 1

Status
Not open for further replies.

molly2ka

Programmer
Mar 20, 2004
27
US
Hi all,

I am looking for a query that will search all of my database without having to use all the individual table names and fields as there are 6 tables and over 30 fields in the database is there any special expression for this the search criteria would only be one word.

Please help. THANKYOU!!
 
This one was previously posted a few days ago. As Rudy pointed out, you could dump your tables to a text file and do a text search. That would certainly suffice in many situations.

If you need to do it by manual SQL query, then there is little alternative to rolling up your sleeves and banging away on the keyboard (it would probably take less time than it took to start this thread). Though a bit of copying and pasting of field names from the results of SHOW CREATE TABLE queries might save some time.

If you want to do it in a program and have the program discover the field names and assemble the query accordingly, you could get it to issue a "SHOW COLUMNS FROM tablename" query for each table; each row returned contains the name of a field in the "Field" field, and you could use that to assemble your query. If you want the program to discover the table names, issue a "SHOW TABLES" query; each row returned contains a table name in the one and only field.
 
hi guys,

thanks for ur help but i decided to put the table name in an array which is then made up of lists of the fields in each table. So i search through each array to construct the query. it works if i use LIKE instead of = as it seems to have a problem with matching strings this way. O well. Ta anyway!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top