How to get SP Stored Procedure code using TSQL from SQL Server

Sometimes upstream (place to collect data) or your vendor may give you the permission on some Stored Procedure. Or you may have restricted SQL management Studio installed in your PC. Or you may can not view those in Management studio. So at that moment how one can view the code. The solution is simple. Use builtin sp_helptext from Query Analyzer or from provider query interface.

sp_helptext Syntax to View Stored Procedure Code:

sp_helptext 'your sp name'

Lets say I have a stored procedure named TestProcedure then the TSQL will be:

sp_helptext 'TestProcedure'

sp_helptext code example & syntax

Posted in Database, SQL Server

Leave a Reply

Your email address will not be published. Required fields are marked *