Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 script for geting stored procedure list & content

Author  Topic 

mgkind
Starting Member

8 Posts

Posted - 2004-10-12 : 06:13:03
How can I get the none system(user defined) stored prcedure list and its content by sql script?

hgorijal
Constraint Violating Yak Guru

277 Posts

Posted - 2004-10-12 : 06:50:44
will this work....

SELECT CAST(CASE WHEN ([status] & 2 = 2) THEN (UNCOMPRESS([ctext])) ELSE [ctext] END AS nvarchar(4000))
FROM syscomments WHERE OBJECTPROPERTY(id,'IsMSShipped') = 0 and OBJECTPROPERTY(id,'IsProcedure') = 1



Hemanth Gorijala
BI Architect / DBA...
Go to Top of Page

mgkind
Starting Member

8 Posts

Posted - 2004-10-17 : 04:01:40
thank you for yor reply hgorijal .
but I wanted the list of the stored procedures seprately from their content
(one guery for getting the sql stored procedures) and one (guery for getting the content by giving the stored procedure name)
and also I don't want the list of system stored procedure come in the list
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-10-17 : 07:41:54
SELECT name FROM sysobjects WHERE type='P' AND ObjectProperty(id, 'IsMSShipped')=0

For the procedure text, you can use sp_helptext:

EXEC sp_helptext 'myProcedure'
Go to Top of Page
   

- Advertisement -