Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query returning all system stored procedures listed by MS SQL Server

How can I get all the system stored procedures listed by MS SQL Server (2012) using an SQL query?

like image 603
Mihai Todor Avatar asked Sep 12 '13 11:09

Mihai Todor


People also ask

How do I return a stored procedure list in SQL Server?

In order to fetch the multiple returned values from the Stored Procedure, you need to make use of a variable with data type and size same as the Output parameter and pass it as Output parameter using OUTPUT keyword. You can also make use of the Split function to split the comma separated (delimited) values into rows.

Where can I find stored procedure in SQL Server query?

Using SQL Server Management StudioIn Object Explorer, connect to an instance of Database Engine and then expand that instance. Expand Databases, expand the database in which the procedure belongs, and then expand Programmability. Expand Stored Procedures, right-click the procedure and then click View Dependencies.


3 Answers

sysobjects is deprecated. You can use

SELECT QUOTENAME(SCHEMA_NAME(schema_id)) + '.' + QUOTENAME(name)
FROM   sys.all_objects
WHERE  type = 'P'
       AND is_ms_shipped = 1 
like image 88
Martin Smith Avatar answered Nov 15 '22 18:11

Martin Smith


SELECT sch.name + '.' + obj.name
  FROM sysobjects obj, sys.schemas sch
  WHERE obj.type = 'P'
    AND sch.schema_id = obj.uid
    AND sch.name = 'sys'
    --AND obj.name like '%my_search_string%'--use this for filtering
  ORDER BY sch.name + '.' + obj.name
like image 29
Mihai Todor Avatar answered Nov 15 '22 18:11

Mihai Todor


SELECT *
FROM   sys.all_objects
WHERE  type = 'P'
       AND is_ms_shipped = 1
like image 23
Suraj Singh Avatar answered Nov 15 '22 18:11

Suraj Singh