May 15, 2008 at 2:02 am
You can this:
declare @input varchar(100),
@id int,
@helpText varchar(max)
set @input = 'Your Stored Proc Name'
set @id =(select top 1 object_id
from sys.objects
where [name] = @input
and type_desc = 'SQL_STORED_PROCEDURE')
set @helpText = (select [text] from sys.syscomments where id = @id)
select @helptext
EDIT: The above is not 100%, but is a step in the right direction. Depending on the length of the sp, there can be more than one record for it's definition.
May 15, 2008 at 7:46 am
That only works for SQL 2000. For SQL 2005 use sys.sql_modules
select definition
from
sys.sql_modules where object_id = object_id ( )
DAB
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply