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

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


当前回答

SELECT name, 
       type
  FROM dbo.sysobjects
 WHERE (type = 'P')

其他回答

这个,列出所有你想要的东西

在Sql Server 2005, 2008, 2012:

Use [YourDataBase]

EXEC sp_tables @table_type = "'PROCEDURE'" 
EXEC sp_tables @table_type = "'TABLE'"
EXEC sp_tables @table_type = "'VIEW'" 

OR

SELECT * FROM information_schema.tables
SELECT * FROM information_schema.VIEWS

试试这个codeplex链接,这个实用程序帮助本地化sql数据库中的所有存储过程。

https://exportmssqlproc.codeplex.com/

select *  
  from dbo.sysobjects
 where xtype = 'P'
   and status > 0

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

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

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

select *
  from sys.procedures
 where is_ms_shipped = 0