Query to list all stored procedures

后端 未结 23 1282
暖寄归人
暖寄归人 2020-11-28 17:18

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 he

相关标签:
23条回答
  • 2020-11-28 18:15

    This, list all things that you want

    In 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
    
    0 讨论(0)
  • 2020-11-28 18:16
    USE DBNAME
    
    select ROUTINE_NAME from information_schema.routines 
    where routine_type = 'PROCEDURE'
    
    
    GO 
    

    This will work on mssql.

    0 讨论(0)
  • 2020-11-28 18:17

    Select All Stored Procedures and Views

    select name,type,type_desc
    from sys.objects
    where type in ('V','P')
    order by name,type
    
    0 讨论(0)
  • 2020-11-28 18:19

    The following will Return All Procedures in selected database

    SELECT * FROM sys.procedures
    
    0 讨论(0)
  • 2020-11-28 18:22

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

    select * 
      from information_schema.routines 
     where routine_type = 'PROCEDURE'
    
    0 讨论(0)
提交回复
热议问题