Solved

Stored procedure in the system table

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

863 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

20 Experts available now in Live!

Get 1:1 Help Now