Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get stored procedure parameters details?

Where can I find information about stored procedure parameters? In my situation I need to know only the input parameters of given store procedure.

In the sys.objects there is only common details about the procedure. In sys.sql_modules I can extract the whole SQL text of a procedure.

As (in SQL Server Management studio) I am able to extract information about the parameters in tabular view using ALT+F1 when selecting the procedure name. I hope there is some place from which I can extract input parameters details in that way.

like image 700
gotqn Avatar asked Nov 21 '13 08:11

gotqn


People also ask

How do I view parameters in SQL?

To view the default value of a parameter in a Transact-SQL object, query the definition column of the sys. sql_modules catalog view, or use the OBJECT_DEFINITION system function.

What are the parameters in stored procedures?

Parameters are used to exchange data between stored procedures and functions and the application or tool that called the stored procedure or function: Input parameters allow the caller to pass a data value to the stored procedure or function.

How do I view stored procedure contents?

Expand Databases, expand the database in which the procedure belongs, and then expand Programmability. Expand Stored Procedures, right-click the procedure and then select Script Stored Procedure as, and then select one of the following: Create To, Alter To, or Drop and Create To. Select New Query Editor Window.

Can pass 3 types of parameters to stored procedures What are they?

As a program, a stored procedure can take parameters. There are three types of parameters: IN, OUT and INOUT.


1 Answers

select      'Parameter_name' = name,      'Type'   = type_name(user_type_id),      'Length'   = max_length,      'Prec'   = case when type_name(system_type_id) = 'uniqueidentifier'                then precision                 else OdbcPrec(system_type_id, max_length, precision) end,      'Scale'   = OdbcScale(system_type_id, scale),      'Param_order'  = parameter_id,      'Collation'   = convert(sysname,                     case when system_type_id in (35, 99, 167, 175, 231, 239)                      then ServerProperty('collation') end)      from sys.parameters where object_id = object_id('MySchema.MyProcedure') 
like image 122
Raj Avatar answered Sep 21 '22 19:09

Raj