开发者

SQL code to open a stored procedure and read it in SQL Server

开发者 https://www.devze.com 2023-03-08 04:39 出处:网络
I am using an interface that only allows me to use SQL co开发者_如何学Gommands. The database is SQL Server. Right now I need to open a stored procedure and read what is inside of it. What is the SQL c

I am using an interface that only allows me to use SQL co开发者_如何学Gommands. The database is SQL Server. Right now I need to open a stored procedure and read what is inside of it. What is the SQL command to open a stored procedure for reading? Thank you.


SELECT definition
    FROM sys.sql_modules 
    WHERE object_id = OBJECT_ID('YourSchemaName.YourProcedureName')


sp_helptext 'dbo.myStoredProc'


SELECT OBJECT_DEFINITION(OBJECT_ID('dbo.myStoredProc'))

Note: subject to Metadata Visibility and VIEW DEFINITION rights


SELECT TEXT
FROM syscomments
WHERE id = (SELECT id FROM sysobjects WHERE name = '<NAME>')
ORDER BY colid 
0

精彩评论

暂无评论...
验证码 换一张
取 消