How to get a list of all SPs in all user databases?

  • Hi Guys,

    Anyone have any custom script to get a list of all SPs in all user databases excluding system SPs.

    Thanks in advance.

    Regards,
    SQLisAwe5oMe.

  • Try something like this...

    CREATE TABLE #procList (procCatalog VARCHAR(256), procSchema VARCHAR(256), procName VARCHAR(256))

    INSERT INTO #procList

    EXEC sp_MSforeachdb

    'SELECT ROUTINE_CATALOG, ROUTINE_SCHEMA, ROUTINE_NAME

    FROM ?.information_schema.routines

    WHERE routine_type = ''PROCEDURE'''

    SELECT * FROM #procList WHERE procCatalog NOT IN ('msdb','master')

    DROP TABLE #procList


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • You can query sys.procedures as well.

  • This can also help to list procedure

    select * from sys.all_objects where type='p' and is_ms_shipped=0

    but it does not list system procedures:

  • Thank you all.

    Regards,
    SQLisAwe5oMe.

Viewing 5 posts - 1 through 4 (of 4 total)

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