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
精彩评论