A query to find the number of parameters in a stored procedure or function on an Sql server?

Well, if I want to find the number of parameters of any stored procedure or function inside SQL SERVER, that is the right way to do this.

Your help will be greatly appreciated. thanks.

+4
source share
2 answers

Try the following query to get a list of all stored procedure parameters. Change the selection to 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>' 
+15
source

INFORMATION_SCHEMA.PARAMETERS should be all you need ...

 SELECT * FROM INFORMATION_SCHEMA.PARAMETERS 
+8
source

Source: https://habr.com/ru/post/1469485/


All Articles