Query to list all stored procedures

2019-01-07 02:00发布

What query can return the names of all the stored procedures in a SQL Server database

If the query could exclude system stored procedures, that would be even more helpful.

22条回答
三岁会撩人
2楼-- · 2019-01-07 02:30

You can try this query to get stored procedures and functions:

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
查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-01-07 02:33

Just the names:

SELECT SPECIFIC_NAME  
FROM YOUR_DB_NAME.information_schema.routines  
WHERE routine_type = 'PROCEDURE'
查看更多
4楼-- · 2019-01-07 02:34
SELECT name, 
       type
  FROM dbo.sysobjects
 WHERE (type = 'P')
查看更多
Lonely孤独者°
5楼-- · 2019-01-07 02:35
select *  
  from dbo.sysobjects
 where xtype = 'P'
   and status > 0
查看更多
我想做一个坏孩纸
6楼-- · 2019-01-07 02:37

Select All Stored Procedures and Views

select name,type,type_desc
from sys.objects
where type in ('V','P')
order by name,type
查看更多
对你真心纯属浪费
7楼-- · 2019-01-07 02:38

If you are using SQL Server 2005 the following will work:

select *
  from sys.procedures
 where is_ms_shipped = 0
查看更多
登录 后发表回答