sql script get all stored procedures from database 1

sql script get all stored procedures from database

SELECT 
  SCHEMA_NAME(schema_id) AS [Schema],
  name
FROM sys.objects
WHERE type = 'P';

Here is what the above code is Doing:
1. We’re using the sys.objects system view to get a list of all the stored procedures in the database.
2. We’re using the SCHEMA_NAME() function to get the schema name for each stored procedure.
3. We’re using the WHERE clause to filter the results to only include stored procedures.
4. We’re using the SELECT clause to return the schema name and the name of each stored procedure.

Here’s the output from the above code:

Schema name
dbo uspGetBillOfMaterials
dbo uspGetEmployeeManagers
dbo uspGetManagerEmployees
dbo uspGetWhereUsedProductID
dbo uspPrintError
dbo uspPrintError
dbo uspSearchCandidateResumes
dbo uspSearchDuplicates
dbo uspSearchJobCandidate
dbo uspUpdateEmployeeHireInfo

Similar Posts