counting the number of stored procedures

  • How to count the number of stored procedures inside a database using sql query?

    please help

  • use Sysobjects

    SELECT COUNT(*) FROM sys.sysobjects

    WHERE xtype = 'p'

  • Or, to avoid system tables which can and do change:

    SELECT COUNT(*)

    FROM INFORMATION_SCHEMA.ROUTINES AS r

    WHERE ROUTINE_TYPE = 'PROCEDURE'

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Or, using the 2005/2008 system views

    SELECT COUNT(*)

    FROM sys.procedures

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • SELECT COUNT(*)

    FROM sys.procedures

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

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