Monday, September 1, 2008

How to View Content Body of Stored Procedure in MySQL

Unlike MSSQL's sp_helptext that lets you view the body of an SQL object (i.e. table, stored procedure, function), MySQL has different commands to view each object's contents.

The commands "show create procedure" and "show create function" are used to check on the contents of either a stored procedure or function, respectively. Simply append the name of the SP or function after the corresponding command like so:

show create procedure spGetData;


Note that you should have privileges for the said routine in order to display the contents of the SQL object. Otherwise, it would return NULL.

No comments:

Your Ad Here