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:24

To list the stored procedures for a particular MySQL database:

SHOW PROCEDURE STATUS WHERE db = 'databaseName';
查看更多
Lonely孤独者°
3楼-- · 2019-01-07 02:24

From my understanding the "preferred" method is to use the information_schema tables:

select * 
  from information_schema.routines 
 where routine_type = 'PROCEDURE'
查看更多
干净又极端
4楼-- · 2019-01-07 02:28

The following will Return All Procedures in selected database

SELECT * FROM sys.procedures
查看更多
老娘就宠你
5楼-- · 2019-01-07 02:28

Try this codeplex link, this utility help to localize all stored procedure from sql database.

https://exportmssqlproc.codeplex.com/

查看更多
做个烂人
6楼-- · 2019-01-07 02:30

This will returned all sp name

Select * 
FROM sys.procedures where [type] = 'P' 
     AND is_ms_shipped = 0 
     AND [name] not like 'sp[_]%diagram%'
查看更多
趁早两清
7楼-- · 2019-01-07 02:30

the best way to get objects is use sys.sql_modules. you can find every thing that you want from this table and join this table with other table to get more information by 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'
查看更多
登录 后发表回答