Search If A Specific Column is Used in Stored Procedure or Functions – MySQL

INFORMATION SCHEMA (also referred as system catalog) gives you access to database metadata and MySQL server information like the name of a database or table, the data type of a column, and access privileges.

We’ll look at how to search a specific column if it’s utilized in Stored Routines (Functions and Stored Procedures) in this article.

— Searching a column in all Functions and Stored Procedures of a specific database.
SELECT * FROM information_schema.ROUTINES
WHERE ROUTINE_SCHEMA = ‘TestDB’
AND ROUTINE_DEFINITION LIKE ‘%DepartmentID%’;

— Searching a column in all Functions and Stored Procedures from all databases.
SELECT * FROM information_schema.ROUTINES
WHERE ROUTINE_DEFINITION LIKE ‘%DepartmentID%’;

Happy learning!!!

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s