Solved

Stored procedure in the system table

Posted on 2001-06-20
4
178 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query 9 27
SQL: Transformation or Pivot 3 35
Microsoft SQL Query sum values over time periods 3 23
Creating Scalar Function 3 17
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

734 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