Identifying the number of Sp''s without I/p parameters

  • Hello All,

    How would you count the number of stored procedures without input parameter/s.

    Regards,

    Praveen

  • SELECT COUNT(*) FROM INFORMATION_SCHEMA.ROUTINES t1

     WHERE NOT EXISTS

      (SELECT * FROM INFORMATION_SCHEMA.PARAMETERS t2

       WHERE t1.SPECIFIC_NAME = t2.SPECIFIC_NAME

       AND PARAMETER_MODE NOT LIKE 'IN')

     AND OBJECTPROPERTY(OBJECT_ID(t1.SPECIFIC_NAME),'IsMSShipped')=0

    You might need to tweak this a little bit, since I use the .PARAMETER views not quite often.

     

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • I think this may also work

    SELECT COUNT (*) FROM SYSOBJECTS WHERE type = 'P'

    Rafi-

  • Hello Frank Kalis,

    Thanks you for the solution, i have tweaked the query like this

    Select NAME from sysobjects where type='P'

    AND

    NAME NOT IN (

    select DISTINCT SPECIFIC_NAME from INFORMATION_SCHEMA.Parameters) to select the sp's which do not have both Input and Output parameters.

    Thanks for the solution,

    Regards

    Praveen

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

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