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

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


当前回答

选择“所有存储过程和视图”

select name,type,type_desc
from sys.objects
where type in ('V','P')
order by name,type

其他回答

你可以尝试这个查询来获取存储过程和函数:

SELECT name, type
FROM dbo.sysobjects
WHERE type IN (
    'P', -- stored procedures
    'FN', -- scalar functions 
    'IF', -- inline table-valued functions
    'TF' -- table-valued functions
)
ORDER BY type, name
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上工作。

这将只给出存储过程的名称。

select specific_name
from information_schema.routines
where routine_type = 'PROCEDURE';

如果你使用的是SQL Server 2005,下面的操作可以正常工作:

select *
  from sys.procedures
 where is_ms_shipped = 0