Select something with location unkown from all tables in database in mysql -
i have varchar value of foo
somewhere in database , don't know exactly.
is possible create query search tables , columns content? similar grep
there isn't easy way this, use information schema find varchar columns.
select table_name, column_name information_schema.columns data_type = 'varchar';
you write query produce list of queries need run search term.
select concat( 'select ', column_name, ' ', table_name, ' ', column_name, ' \'%foo%\'' ) stmt information_schema.columns data_type = 'varchar';
a more advanced example might insert matches results table along table , column names.
Comments
Post a Comment