Listing Stored Procedures

  • Anyone have knowledge of a Stored procedure that lists all stored procedures on a server?

  • select * from sysobjects where xtype = 'P'...

    should give you all stored procedures for a given database...and unless you have user defined procs created with dt...you could extend it to:

    select * from sysobjects where xtype = 'P'

    and name not like 'dt%'

    order by name







    **ASCII stupid question, get a stupid ANSI !!!**

  • Is there is a SP that automatically does this for all SP's on a Particular Server, (EveryDB). with out me having to make a cursor?

  • there's an undocumented sp_MSForEachDB that you should be able to use...if you search the forums you're guaranteed to find the script for it somewhere...







    **ASCII stupid question, get a stupid ANSI !!!**

  • i cannot test this on my machine but see if this works...

    exec sp_MSForEachDB "select * from sysobjects where xtype = 'P'

    and name not like 'dt%'

    order by name"







    **ASCII stupid question, get a stupid ANSI !!!**

  • Seems to do what i needed. Thank you very much!!

  • Short version :

    EXEC SP_MSFOREACHDB 'Select ''?'' as DbName, Name from ?.dbo.SysObjects where Status >= 0 and XType = ''P'' order By Name'

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply