查询以查找 Sql Server 中存储过程或函数中的参数数量? [英] Query to find Number of Parameters in a Stored Procedure or Function in Sql Server?

查看:34
本文介绍了查询以查找 Sql Server 中存储过程或函数中的参数数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,如果我想在 SQL SERVER 中查找任何存储过程或函数的参数计数,那么正确的方法是什么.

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. thanks.

推荐答案

尝试以下查询以获取存储过程的所有参数的列表.如果您只想要参数的数量,请将选择更改为 COUNT(*).

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>'

这篇关于查询以查找 Sql Server 中存储过程或函数中的参数数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆