简体   繁体   中英

How do I get a table of a database's stored procedures (excluding system stored procedures) along with its definition?

This is what I have now. This gets me a list of the stored procedures, but I need an additional column with their respective definition.

SELECT 
name 
FROM sys.objects
WHERE type = 'P'
order by name

I've also tried adding another line below the SELECT (definition as OBJECT_DEFINITION).

Here is how to get the definition and stored procedure name in Sql Server

SELECT o.name, m.definition
FROM sys.objects o
INNER JOIN sys.sql_modules m 
ON o.object_id = m.object_id
WHERE o.type = 'P';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM