什么查询可以返回SQL Server数据库中所有存储过程的名称

如果查询可以排除系统存储过程,那将更有帮助。


当前回答

这将返回所有sp名称

Select * 
FROM sys.procedures where [type] = 'P' 
     AND is_ms_shipped = 0 
     AND [name] not like 'sp[_]%diagram%'

其他回答

exec sp_stored_procedures; Docs.Microsoft.com

很容易记住。

USE DBNAME

select ROUTINE_NAME from information_schema.routines 
where routine_type = 'PROCEDURE'


GO 

这将在mssql上工作。

select *  
  from dbo.sysobjects
 where xtype = 'P'
   and status > 0
SELECT name, 
       type
  FROM dbo.sysobjects
 WHERE (type = 'P')

根据我的理解,“首选”方法是使用information_schema表:

select * 
  from information_schema.routines 
 where routine_type = 'PROCEDURE'