Solved

Stored procedure in the system table

Posted on 2001-06-20
4
172 Views
Last Modified: 2012-05-04
Well,

I am just wondering how I can get the stored procedure out of the system tables. The reason for that is that every stored procedure starts with a heading with the purpose and author of it. So I would just like to filter this out of the stored procedure and create a document of it.

Lex van de Pol
0
Comment
Question by:Lexie
  • 2
4 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 6209634
i'm not sure if i understood correctly, but it might be this:

SELECT ProcName = o.Name, OwnerName = u.Name
FROM sysobjects o JOIN sysusers u ON u.uid = o.uid
WHERE type = 'P'

Cheers
0
 
LVL 3

Author Comment

by:Lexie
ID: 6209758
No, I'm not looking for the names but the content. For example, I have the following stored procedure:

-- Purpose: this is just a test
-- Author : just me
CREATE PROCEDURE proc_test AS
BEGIN

blabla

END

I would like to run a query to get the header out of this stored procedure.
0
 
LVL 18

Accepted Solution

by:
nigelrivett earned 50 total points
ID: 6209819
You can get the stored procedure names from sysobjects where type = 'P' or the information_scema views.
For each of these (don't use a cursor - put them in a temp table) you can run sp_helptext putting the result into a temp table. You can then put the apllicable rows into a table and select as necessary.

The other option is via syscomments which would be similar but probably more dificult.
0
 
LVL 3

Author Comment

by:Lexie
ID: 6209866
Thanks, that was what I was looking for!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now