Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am using an interface that only allows me to use SQL commands. 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.

like image 687
Marcos Buarque Avatar asked May 25 '11 19:05

Marcos Buarque


2 Answers

SELECT definition
    FROM sys.sql_modules 
    WHERE object_id = OBJECT_ID('YourSchemaName.YourProcedureName')
like image 148
Joe Stefanelli Avatar answered Oct 24 '22 02:10

Joe Stefanelli


sp_helptext 'dbo.myStoredProc'
like image 43
Fosco Avatar answered Oct 24 '22 04:10

Fosco