Query to list all stored procedures

后端 未结 23 1464
暖寄归人
暖寄归人 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:00

    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'
    

提交回复
热议问题