Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the list of all stored procedures and their parameters starting with a certain prefix?

Is there a way to query the database and retrieve a list of all stored procedures and their parameters?
I am using SQL Server 2000.

like image 898
the_drow Avatar asked Feb 28 '10 11:02

the_drow


1 Answers

To get information on the stored procedures:

SELECT * FROM INFORMATION_SCHEMA.ROUTINES 

To find the sprocs starting with a certain prefix (e.g. "usp"):

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME LIKE 'usp%'

To find all the parameters for a stored procedure:

SELECT * FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME='YourSprocName'

To find all the parameters for all stored procedures starting with a certain prefix:

SELECT * FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME LIKE 'usp%'
like image 196
AdaTheDev Avatar answered Oct 24 '22 02:10

AdaTheDev