How to fetch entire table name and entire field name for a particualr data ?

Hi ,

I have a data ( A012) which is is stored in many tables and in different fields in database .

how to find the field name and the table names for this particular data ?

Thanks .

Maybe you can query the information_schema.tables database to get the field name and table name.

Hi mshuhaib20;

This would be a tough one, since you basically want to check EVERY column in every table in every database for a certain data value. MySQL is not setup to work like that easily.

I could see two possible solutions:

  1. Write a short bash script to query the information_schema to get a list of all all database/table/column combinations, query each column individually looking for your data value, and then record the database/table/column name if you get a result back. Depending on your database size, this could be a very, very slow process.

  2. Do a mysqldump with the --complete-insert option of all your databases and tables, then parse through the dump file to locate the data value you are looking for. Depending on how good you are with tools like grep/sed/awk/cut/etc., this may be the easier option.