Monday, May 24, 2021

Retrieve List of all Stored Procedures in SQL Server

The following queries will return a list of all Stored Procedures in the database, with basic information about each Stored Procedure:

We can achieve this by various methods.

Method 1:

USE AdventureWorks2017
GO
SELECT *
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_TYPE = 'PROCEDURE'

The ROUTINE_NAME, ROUTINE_SCHEMA and ROUTINE_DEFINITION columns are generally the most useful

Output:


Below both the methods will yield same result.

Method 2:

SELECT *
FROM sys.objects
WHERE type = 'P'

Method 3:

SELECT *
FROM sys.procedures

Output:


Related Article:

No comments:

Post a Comment