List:General Discussion« Previous MessageNext Message »
From:Joerg Bruehe Date:August 2 2005 10:42am
Subject:Re: search in all tables in the data base ..
View as plain text  
Hi!


Gregory Machin wrote:
> Hi all.
> Please could you advise.
> I would like to know if one could do a recursive search through a data
> base and get a result of wich column and field is holding the string ?

SQL (the language) always requires the table and column name to be given 
as constant text within the statement, you cannot use variables there.
(Sole exception: "SELECT *" for the list of columns to return.)

If you want to search through all columns of all tables, you need an 
application that first determines the list of tables, for each table 
that of its columns, then for each combination generates a

     SELECT col FORM tab WHERE col = 'string'

and executes it (ignoring the wrong datatype if the column is a numeric 
one).

As an alternative, you can take a plain text dump of the database and 
scan this.

HTH,
Jörg

-- 
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com
Thread
search in all tables in the data base ..Gregory Machin28 Jul
  • Re: search in all tables in the data base ..Joerg Bruehe2 Aug