This stored procedure is tested on mysql 5.0.83-community-nt-log on windows machine successfully.
Summary of snippet:
- Create a table for storing output.
- Loop through information_schema database's COLUMNS table to obtain all databases, table and column names.
- Execute a count(*) query on database.table for each column with appropriate search string in where condition.
- If count(*) > 0, that perticular column has the search term.
- Insert that triplet (database name, table name, column name) in to a table.
- Select * from table to view respective database,table and column names having the search term.