Solved

Stored procedure in the system table

Posted on 2001-06-20
4
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 143

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
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
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

630 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