Quick and simple way to know the stored procedures parameters using TSQL

Published 08 July 08 04:13 AM | SQL Master 

As you may be aware that you can pass parameters to the stored procedure when you have the selection of data requirement such as stored procedure with data type,length, parameter position and also the mode of parameter (Input or Output).

Using INFORMATION_SCHEMA views you can get further information on what kind of parameters are used within a stored procedure without viewing the stored procedure or calling it to execute.

select Specific_Name as 'Procedure_Name', Parameter_Name, Ordinal_Position as 'Param_Position',  case Parameter_Mode when 'IN' then 'Input' else 'Output' end as 'Mode', Data_Type, Character_Maximum_Length 'Data_Length'
from information_schema.Parameters where specific_name = @Proc_Name
go

This is another best example to state how flexible it is to use INFORMATION_SCHEMA views that are one of the hidden gems in SQL Server.

Comments

# SQL Server Transact-SQL (SSQA.net) : Quick and simple way to know the stored procedures parameters using TSQL said on July 8, 2008 4:52 AM:

PingBack from http://sqlserver-qa.net/blogs/t-sql/archive/2008/07/08/4556.aspx

# Other SQL Server Blogs around the Web said on July 8, 2008 6:11 AM:

As you may be aware that you can pass parameters to the stored procedure when you have the selection

Anonymous comments are disabled

About SQL Master

**__________________________________** SQL Server MVP, Sr. DBA & industry expert. - Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it. It is also a power and you will gain by sharing it.