Searching for objects in mysql

3

Good afternoon, I am using WorkBeanch 6.3 and I need to search the MySql database if a particular Column exists and what its Table, I also need to know if the particular Column is used in a Procedure or View, for example in Sql Server I do this;

      SELECT O.name as Tabelas 
        FROM syscolumns C 
  INNER JOIN sysobjects O ON C.id = O.id 
       WHERE c.name like '%idConta%'
    
asked by anonymous 21.12.2015 / 19:13

1 answer

1

You could try like this, where you do not like pass the idConta

SELECT SPECIFIC_NAME FROM information_schema.routines WHERE ROUTINE_DEFINITION like '%idConta%'

To find object definers, work on the 'information_schema' table, where you get the object information, you will get a lot of it. Below, select examples to discover the definers.

SELECT specific_name, routine_schema, routine_name, routine_type, definer FROM information_schema.routines WHERE definer = 'seu_user'; 

SELECT trigger_catalog, trigger_schema, trigger_name, definer FROM information_schema.triggers WHERE definer = 'seu_user';

SELECT table_catalog, table_schema, table_name, definer FROM information_schema.views WHERE definer = 'seu_user';
    
21.12.2015 / 20:05