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

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


当前回答

在SQL server中选择存储过程列表。更多信息请参考这里: https://coderrooms.blogspot.com/2017/06/select-list-of-stored-procedure-in-sql.html

其他回答

这也可以帮助列出除了系统过程之外的过程:

select * from sys.all_objects where type='p' and is_ms_shipped=0

获取对象的最佳方法是使用sys.sql_modules。您可以从这个表中找到所需的所有内容,并通过object_id将这个表与其他表连接起来以获取更多信息

SELECT o. object_id,o.name AS name,o.type_desc,m.definition,schemas.name scheamaName
FROM sys.sql_modules        m 
    INNER JOIN sys.objects  o ON m.object_id=o.OBJECT_ID
    INNER JOIN sys.schemas ON schemas.schema_id = o.schema_id
    WHERE [TYPE]='p'
select *  
  from dbo.sysobjects
 where xtype = 'P'
   and status > 0
USE DBNAME

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


GO 

这将在mssql上工作。

在SQL server中选择存储过程列表。更多信息请参考这里: https://coderrooms.blogspot.com/2017/06/select-list-of-stored-procedure-in-sql.html