Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql: Find all stored procedures that reference a specific table

Tags:

mysql

I want to check all SPs/function that reference a particular table in mysql. I found a query which I belive is to check the same in sql server:

SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%tablename%'

But in mysql it says 'Table sys.procedures doesn't exist'

like image 430
Sahil Sharma Avatar asked Dec 10 '22 10:12

Sahil Sharma


1 Answers

select * from information_schema.ROUTINES where ROUTINE_DEFINITION like '%tableName%'; 
like image 81
Nickhil Avatar answered Jan 21 '23 16:01

Nickhil