Query to find Number of Parameters in a Stored Procedure or Function in Sql Server?

后端 未结 3 818
盖世英雄少女心
盖世英雄少女心 2020-12-19 12:59

Well, if i want to find parameter count of any stored procedure or function inside SQL SERVER, what is the correct way to do it.

Your help would be appreciated. tha

相关标签:
3条回答
  • 2020-12-19 13:45
    SELECT  *
    FROM    INFORMATION_SCHEMA.PARAMETERS where SPECIFIC_NAME = 'YourProcedureName'
    
    0 讨论(0)
  • 2020-12-19 13:55

    INFORMATION_SCHEMA.PARAMETERS should be all you need...

    SELECT  *
    FROM    INFORMATION_SCHEMA.PARAMETERS
    
    0 讨论(0)
  • 2020-12-19 13:57

    Try the following query to get a list of all parameters for a stored procedure. Change the select to a COUNT(*) if you just want the number of parameters.

    SELECT 
        p.name AS Parameter,        
        t.name AS [Type]
    FROM sys.procedures sp
    JOIN sys.parameters p 
        ON sp.object_id = p.object_id
    JOIN sys.types t
        ON p.system_type_id = t.system_type_id
    WHERE sp.name = '<name>'
    
    0 讨论(0)
提交回复
热议问题